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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat May 11 20:20:37 UTC 2019


 sc/inc/globstr.hrc                              |    3 
 sc/inc/scabstdlg.hxx                            |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx              |   23 ++-
 sc/source/ui/attrdlg/scdlgfact.hxx              |   15 +-
 sc/source/ui/condformat/condformatmgr.cxx       |  173 +++++++++--------------
 sc/source/ui/inc/condformatmgr.hxx              |   41 ++---
 sc/source/ui/view/cellsh1.cxx                   |    5 
 sc/uiconfig/scalc/ui/condformatmanager.ui       |  178 +++++++++++++++---------
 sc/uiconfig/scalc/ui/conditionalformatdialog.ui |    4 
 9 files changed, 232 insertions(+), 212 deletions(-)

New commits:
commit b8061f41373cc90823c93cf9f025647c93496293
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat May 11 19:51:21 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat May 11 22:19:28 2019 +0200

    weld ScCondFormatManagerDlg
    
    Change-Id: Iccf2657f2c8fe98b4e975936fb75d56fc9523b5a
    Reviewed-on: https://gerrit.libreoffice.org/72162
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 614beb5300bb..78437dc9f9d3 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -423,7 +423,6 @@
 #define STR_UNDO_INSERT_CURRENT_TIME            NC_("STR_UNDO_INSERT_CURRENT_TIME", "Insert Current Time")
 #define STR_MANAGE_NAMES                        NC_("STR_MANAGE_NAMES", "Manage Names...")
 #define STR_HEADER_NAME                         NC_("STR_HEADER_NAME", "Name")
-#define STR_HEADER_RANGE_OR_EXPR                NC_("STR_HEADER_RANGE_OR_EXPR", "Range or formula expression")
 #define STR_HEADER_SCOPE                        NC_("STR_HEADER_SCOPE", "Scope")
 #define STR_MULTI_SELECT                        NC_("STR_MULTI_SELECT", "(multiple)")
 #define STR_GLOBAL_SCOPE                        NC_("STR_GLOBAL_SCOPE", "Document (Global)")
@@ -431,8 +430,6 @@
 #define STR_ERR_NAME_INVALID                    NC_("STR_ERR_NAME_INVALID", "Invalid name. Only use letters, numbers and underscore.")
 #define STR_UNSAVED_EXT_REF                     NC_("STR_UNSAVED_EXT_REF", "This Document contains external references to unsaved documents.\n\nDo you want to continue?")
 #define STR_CLOSE_WITH_UNSAVED_REFS             NC_("STR_CLOSE_WITH_UNSAVED_REFS", "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.")
-#define STR_HEADER_RANGE                        NC_("STR_HEADER_RANGE", "Range")
-#define STR_HEADER_COND                         NC_("STR_HEADER_COND", "First Condition")
 #define STR_COND_CONDITION                      NC_("STR_COND_CONDITION", "Cell value is")
 #define STR_COND_COLORSCALE                     NC_("STR_COND_COLORSCALE", "ColorScale")
 #define STR_COND_DATABAR                        NC_("STR_COND_DATABAR", "DataBar")
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index cb6ba6933ee7..afada832cfa0 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -410,7 +410,7 @@ public:
 
     virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0;
 
-    virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0;
+    virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0;
 
     virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0;
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 057935500c69..a2b4e4c2b02f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -82,7 +82,15 @@ short AbstractScColRowLabelDlg_Impl::Execute()
     return m_xDlg->run();
 }
 
-IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl);
+short AbstractScCondFormatManagerDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
+bool AbstractScCondFormatManagerDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+{
+    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
 
 short AbstractScDataPilotDatabaseDlg_Impl::Execute()
 {
@@ -510,22 +518,22 @@ sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh()
 
 std::unique_ptr<ScConditionalFormatList> AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList()
 {
-    return pDlg->GetConditionalFormatList();
+    return m_xDlg->GetConditionalFormatList();
 }
 
 bool AbstractScCondFormatManagerDlg_Impl::CondFormatsChanged() const
 {
-    return pDlg->CondFormatsChanged();
+    return m_xDlg->CondFormatsChanged();
 }
 
 void AbstractScCondFormatManagerDlg_Impl::SetModified()
 {
-    return pDlg->SetModified();
+    return m_xDlg->SetModified();
 }
 
 ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected()
 {
-    return pDlg->GetCondFormatSelected();
+    return m_xDlg->GetCondFormatSelected();
 }
 
 int AbstractScMetricInputDlg_Impl::GetInputValue() const
@@ -761,10 +769,9 @@ VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarni
     return VclPtr<AbstractScSortWarningDlg_Impl>::Create(std::make_unique<ScSortWarningDlg>(pParent, rExtendText, rCurrentText));
 }
 
-VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList )
+VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList )
 {
-    VclPtr<ScCondFormatManagerDlg> pDlg = VclPtr<ScCondFormatManagerDlg>::Create( pParent, pDoc, pFormatList );
-    return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(std::make_unique<ScCondFormatManagerDlg>(pParent, pDoc, pFormatList));
 }
 
 VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 14d6b5317467..dcf1566d60c9 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -131,14 +131,17 @@ public:
 
 class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg
 {
-    DECL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl, ScCondFormatManagerDlg)
-
+    std::shared_ptr<ScCondFormatManagerDlg> m_xDlg;
+public:
+    explicit AbstractScCondFormatManagerDlg_Impl(std::unique_ptr<ScCondFormatManagerDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
+    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
     virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() override;
-
     virtual bool CondFormatsChanged() const override;
-
     virtual void SetModified() override;
-
     virtual ScConditionalFormat* GetCondFormatSelected() override;
 };
 
@@ -597,7 +600,7 @@ public:
 
     virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override;
 
-    virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override;
+    virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override;
 
     virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) override;
 
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 057ef9a963a7..1ac76ac319b1 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -15,194 +15,155 @@
 #include <document.hxx>
 #include <conditio.hxx>
 
-ScCondFormatManagerWindow::ScCondFormatManagerWindow(SvSimpleTableContainer& rParent,
+ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView,
     ScDocument* pDoc, ScConditionalFormatList* pFormatList)
-    : SvSimpleTable(rParent, WB_HSCROLL | WB_SORT | WB_TABSTOP)
+    : mrTreeView(rTreeView)
     , mpDoc(pDoc)
     , mpFormatList(pFormatList)
 {
-    OUString aConditionStr(ScResId(STR_HEADER_COND));
-    OUString aRangeStr(ScResId(STR_HEADER_RANGE));
-
-    OUStringBuffer sHeader;
-    sHeader.append(aRangeStr).append("\t").append(aConditionStr);
-    InsertHeaderEntry(sHeader.makeStringAndClear(), HEADERBAR_APPEND, HeaderBarItemBits::LEFT);
+    mrTreeView.set_size_request(mrTreeView.get_approximate_digit_width() * 70,
+                                mrTreeView.get_height_rows(20));
     setColSizes();
 
     Init();
-    Show();
-    SetSelectionMode(SelectionMode::Multiple);
-}
-
-OUString ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& rFormat)
-{
-    const ScRangeList& aRange = rFormat.GetRange();
-    OUString aStr;
-    aRange.Format(aStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention());
-    aStr += "\t";
-    aStr += ScCondFormatHelper::GetExpression(rFormat, aRange.GetTopLeftCorner());
-    return aStr;
+    mrTreeView.set_selection_mode(SelectionMode::Multiple);
+    mrTreeView.make_sorted();
 }
 
 void ScCondFormatManagerWindow::Init()
 {
-    SetUpdateMode(false);
+    mrTreeView.freeze();
 
     if (mpFormatList)
     {
+        int nRow = 0;
+        OUString sRangeStr;
         for(const auto& rItem : *mpFormatList)
         {
-            SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(*rItem) );
-            maMapLBoxEntryToCondIndex.insert(std::pair<SvTreeListEntry*,sal_Int32>(pEntry, rItem->GetKey()));
+            const ScRangeList& aRange = rItem->GetRange();
+            aRange.Format(sRangeStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention());
+            mrTreeView.append(OUString::number(rItem->GetKey()), sRangeStr);
+            mrTreeView.set_text(nRow, ScCondFormatHelper::GetExpression(*rItem, aRange.GetTopLeftCorner()), 1);
+            ++nRow;
         }
     }
 
-    SetUpdateMode(true);
+    mrTreeView.thaw();
 
     if (mpFormatList && !mpFormatList->empty())
-        SelectRow(0);
-}
-
-void ScCondFormatManagerWindow::Resize()
-{
-    SvSimpleTable::Resize();
-    if (GetParentDialog()->isCalculatingInitialLayoutSize())
-        setColSizes();
+        mrTreeView.select(0);
 }
 
 void ScCondFormatManagerWindow::DeleteSelection()
 {
-    if(GetSelectionCount())
+    auto aSelectedRows = mrTreeView.get_selected_rows();
+    std::sort(aSelectedRows.begin(), aSelectedRows.end());
+    for (auto it = aSelectedRows.rbegin(); it != aSelectedRows.rend(); ++it)
     {
-        for(SvTreeListEntry* pEntry = FirstSelected(); pEntry != nullptr; pEntry = NextSelected(pEntry))
-        {
-            sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
-            mpFormatList->erase(nIndex);
-        }
-        RemoveSelection();
+        sal_Int32 nIndex = mrTreeView.get_id(*it).toInt32();
+        mpFormatList->erase(nIndex);
+        mrTreeView.remove(*it);
     }
 }
 
 ScConditionalFormat* ScCondFormatManagerWindow::GetSelection()
 {
-    SvTreeListEntry* pEntry = FirstSelected();
-    if(!pEntry)
+    int nEntry = mrTreeView.get_selected_index();
+    if (nEntry == -1)
         return nullptr;
 
-    sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
+    sal_Int32 nIndex = mrTreeView.get_id(nEntry).toInt32();
     return mpFormatList->GetFormat(nIndex);
 }
 
 void ScCondFormatManagerWindow::setColSizes()
 {
-    HeaderBar &rBar = GetTheHeaderBar();
-    if (rBar.GetItemCount() < 2)
-        return;
-    long aStaticTabs[]= { 0, 0 };
-    aStaticTabs[1] = rBar.GetSizePixel().Width() / 2;
-    SvSimpleTable::SetTabs(SAL_N_ELEMENTS(aStaticTabs), aStaticTabs, MapUnit::MapPixel);
-}
-
-ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList):
-    ModalDialog(pParent, "CondFormatManager", "modules/scalc/ui/condformatmanager.ui"),
-    mpFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr),
-    mbModified(false)
-{
-    SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("CONTAINER");
-    Size aSize(LogicToPixel(Size(290, 220), MapMode(MapUnit::MapAppFont)));
-    pContainer->set_width_request(aSize.Width());
-    pContainer->set_height_request(aSize.Height());
-    m_pCtrlManager = VclPtr<ScCondFormatManagerWindow>::Create(*pContainer, pDoc, mpFormatList.get());
-    get(m_pBtnAdd, "add");
-    get(m_pBtnRemove, "remove");
-    get(m_pBtnEdit, "edit");
-
-    m_pBtnRemove->SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
-    m_pBtnEdit->SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl));
-    m_pBtnAdd->SetClickHdl(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
-    m_pCtrlManager->SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
-
-    UpdateButtonSensitivity();
+    std::vector<int> aWidths;
+    aWidths.push_back(mrTreeView.get_size_request().Width() / 2);
+    mrTreeView.set_column_fixed_widths(aWidths);
 }
 
-ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
+ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList)
+    : GenericDialogController(pParent, "modules/scalc/ui/condformatmanager.ui", "CondFormatManager")
+    , m_bModified(false)
+    , m_xFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr)
+    , m_xBtnAdd(m_xBuilder->weld_button("add"))
+    , m_xBtnRemove(m_xBuilder->weld_button("remove"))
+    , m_xBtnEdit(m_xBuilder->weld_button("edit"))
+    , m_xTreeView(m_xBuilder->weld_tree_view("CONTAINER"))
+    , m_xCtrlManager(new ScCondFormatManagerWindow(*m_xTreeView, pDoc, m_xFormatList.get()))
 {
-    disposeOnce();
+    m_xBtnRemove->connect_clicked(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
+    m_xBtnEdit->connect_clicked(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl));
+    m_xBtnAdd->connect_clicked(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
+    m_xTreeView->connect_row_activated(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
+
+    UpdateButtonSensitivity();
 }
 
-void ScCondFormatManagerDlg::dispose()
+ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
 {
-    mpFormatList.reset();
-    m_pBtnAdd.clear();
-    m_pBtnRemove.clear();
-    m_pBtnEdit.clear();
-    m_pCtrlManager.disposeAndClear();
-    ModalDialog::dispose();
 }
 
-
 std::unique_ptr<ScConditionalFormatList> ScCondFormatManagerDlg::GetConditionalFormatList()
 {
-    return std::move(mpFormatList);
+    return std::move(m_xFormatList);
 }
 
 void ScCondFormatManagerDlg::UpdateButtonSensitivity()
 {
-    OUString aNewSensitivity = mpFormatList->empty() ? OUString("false") : OUString("true");
-    m_pBtnRemove->set_property("sensitive", aNewSensitivity);
-    m_pBtnEdit->set_property("sensitive", aNewSensitivity);
+    bool bNewSensitivity = !m_xFormatList->empty();
+    m_xBtnRemove->set_sensitive(bNewSensitivity);
+    m_xBtnEdit->set_sensitive(bNewSensitivity);
 }
 
 // Get the current conditional format selected.
 //
 ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected()
 {
-    return m_pCtrlManager->GetSelection();
+    return m_xCtrlManager->GetSelection();
 }
 
-IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, weld::Button&, void)
 {
-    m_pCtrlManager->DeleteSelection();
-    mbModified = true;
+    m_xCtrlManager->DeleteSelection();
+    m_bModified = true;
     UpdateButtonSensitivity();
 }
 
-IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, Button*, void)
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, weld::Button&, void)
 {
-    mbModified = true;
-    EditBtnHdl(nullptr);
-    // EditBtnHdl() might call EndDialog which will blow us away
-    if (!IsDisposed())
-        UpdateButtonSensitivity();
+    EditBtnHdl(*m_xTreeView);
 }
-IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, SvTreeListBox*, bool)
+
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, weld::TreeView&, void)
 {
-    ScConditionalFormat* pFormat = m_pCtrlManager->GetSelection();
+    ScConditionalFormat* pFormat = m_xCtrlManager->GetSelection();
 
-    if(!pFormat)
-        return false;
+    if (!pFormat)
+        return;
 
-    mbModified = true;
-    EndDialog( DLG_RET_EDIT );
+    m_bModified = true;
+    m_xDialog->response( DLG_RET_EDIT );
 
-    return false;
+    return;
 }
 
-IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, weld::Button&, void)
 {
-    mbModified = true;
-    EndDialog( DLG_RET_ADD );
+    m_bModified = true;
+    m_xDialog->response( DLG_RET_ADD );
 }
 
 void ScCondFormatManagerDlg::SetModified()
 {
-    mbModified = true;
+    m_bModified = true;
     UpdateButtonSensitivity();
 }
 
 bool ScCondFormatManagerDlg::CondFormatsChanged() const
 {
-    return mbModified;
+    return m_bModified;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index 1d3cbf101e75..94bbf346cb1d 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -10,9 +10,7 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
 
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <svtools/simptabl.hxx>
+#include <vcl/weld.hxx>
 
 #include <map>
 
@@ -20,31 +18,28 @@ class ScDocument;
 class ScConditionalFormat;
 class ScConditionalFormatList;
 
-class ScCondFormatManagerWindow : public SvSimpleTable
+class ScCondFormatManagerWindow
 {
 private:
     void Init();
-    OUString createEntryString(const ScConditionalFormat& rFormat);
     void setColSizes();
 
+    weld::TreeView& mrTreeView;
     ScDocument* const mpDoc;
     ScConditionalFormatList* mpFormatList;
-    std::map<SvTreeListEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
 
 public:
-    ScCondFormatManagerWindow(SvSimpleTableContainer& rParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
+    ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
 
     void DeleteSelection();
     ScConditionalFormat* GetSelection();
-    virtual void Resize() override;
 };
 
-class ScCondFormatManagerDlg : public ModalDialog
+class ScCondFormatManagerDlg : public weld::GenericDialogController
 {
 public:
-    ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList);
+    ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList);
     virtual ~ScCondFormatManagerDlg() override;
-    virtual void dispose() override;
 
     std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList();
 
@@ -54,19 +49,21 @@ public:
     ScConditionalFormat* GetCondFormatSelected();
 
 private:
-    VclPtr<PushButton> m_pBtnAdd;
-    VclPtr<PushButton> m_pBtnRemove;
-    VclPtr<PushButton> m_pBtnEdit;
-    std::unique_ptr<ScConditionalFormatList> mpFormatList;
-    VclPtr<ScCondFormatManagerWindow> m_pCtrlManager;
-    void UpdateButtonSensitivity();
+    bool m_bModified;
+    std::unique_ptr<ScConditionalFormatList> m_xFormatList;
+
+    std::unique_ptr<weld::Button> m_xBtnAdd;
+    std::unique_ptr<weld::Button> m_xBtnRemove;
+    std::unique_ptr<weld::Button> m_xBtnEdit;
+    std::unique_ptr<weld::TreeView> m_xTreeView;
+    std::unique_ptr<ScCondFormatManagerWindow> m_xCtrlManager;
 
-    DECL_LINK(RemoveBtnHdl, Button*, void);
-    DECL_LINK(EditBtnClickHdl, Button*, void);
-    DECL_LINK(AddBtnHdl, Button*, void);
-    DECL_LINK(EditBtnHdl, SvTreeListBox*, bool);
+    void UpdateButtonSensitivity();
 
-    bool mbModified;
+    DECL_LINK(RemoveBtnHdl, weld::Button&, void);
+    DECL_LINK(EditBtnClickHdl, weld::Button&, void);
+    DECL_LINK(AddBtnHdl, weld::Button&, void);
+    DECL_LINK(EditBtnHdl, weld::TreeView&, void);
 };
 
 #endif
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 7dc9a5e456ef..791716a66faf 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2541,8 +2541,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 if (!pList)
                     pList = pDoc->GetCondFormList( aPos.Tab() );
 
+                vcl::Window* pWin = pTabViewShell->GetDialogParent();
                 VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
-                    pTabViewShell->GetDialogParent(), pDoc, pList));
+                    pWin ? pWin->GetFrameWeld() : nullptr, pDoc, pList));
 
                 if (pDlgItem)
                     pDlg->SetModified();
@@ -2579,6 +2580,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
                     if (pDlgItem)
                         pTabViewShell->GetPool().Remove(*pDlgItem);
+
+                    pDlg->disposeOnce();
                 });
             }
             break;
diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui
index 0ae3b2d9c80e..c5e06da45e58 100644
--- a/sc/uiconfig/scalc/ui/condformatmanager.ui
+++ b/sc/uiconfig/scalc/ui/condformatmanager.ui
@@ -1,13 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name text2 -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkDialog" id="CondFormatManager">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="condformatmanager|CondFormatManager">Manage Conditional Formatting</property>
     <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -15,10 +31,69 @@
         <property name="vexpand">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkFrame" id="frame1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
             <property name="label_xalign">0</property>
             <property name="shadow_type">none</property>
             <child>
@@ -33,16 +108,54 @@
                   <object class="GtkBox" id="box1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="vexpand">True</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="svtlo-SvSimpleTableContainer" id="CONTAINER">
+                      <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" id="Simple Table Container-selection"/>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkTreeView" id="CONTAINER">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="model">liststore1</property>
+                            <property name="search_column">0</property>
+                            <property name="show_expanders">False</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                                <property name="resizable">True</property>
+                                <property name="spacing">6</property>
+                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_RANGE">First Condition</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderer1"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                                <property name="resizable">True</property>
+                                <property name="spacing">6</property>
+                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_RANGE">Range</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderer2"/>
+                                  <attributes>
+                                    <attribute name="text">1</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
                         </child>
                       </object>
                       <packing>
@@ -124,63 +237,6 @@
             <property name="position">0</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="ok">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
       </object>
     </child>
     <action-widgets>
diff --git a/sc/uiconfig/scalc/ui/conditionalformatdialog.ui b/sc/uiconfig/scalc/ui/conditionalformatdialog.ui
index 57b509d5a26c..b815d5df3353 100644
--- a/sc/uiconfig/scalc/ui/conditionalformatdialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionalformatdialog.ui
@@ -140,10 +140,6 @@
                                 <child>
                                   <placeholder/>
                                 </child>
-                                <style>
-                                  <class name="notebook"/>
-                                  <class name="stack"/>
-                                </style>
                               </object>
                             </child>
                           </object>


More information about the Libreoffice-commits mailing list