[Libreoffice-commits] core.git: cui/inc cui/source cui/uiconfig extras/source solenv/bin

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 31 19:04:52 UTC 2019


 cui/inc/strings.hrc                            |    3 
 cui/source/options/connpooloptions.cxx         |  408 ++++++-------------------
 cui/source/options/connpooloptions.hxx         |   44 +-
 cui/source/options/connpoolsettings.hxx        |    4 
 cui/uiconfig/ui/connpooloptions.ui             |  144 ++++++--
 extras/source/glade/libreoffice-catalog.xml.in |    4 
 solenv/bin/native-code.py                      |    1 
 7 files changed, 230 insertions(+), 378 deletions(-)

New commits:
commit 56bde3321e36347ccccfaf57ccfc2bd7bb8715d5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 31 16:33:53 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jul 31 21:03:55 2019 +0200

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

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 482a9e44a34d..e1fdec1ef480 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -224,9 +224,6 @@
 // $(ROW) can be a number or the caption of the row in quotes
 #define RID_SVXSTR_DIAGRAM_ROW                      NC_("RID_SVXSTR_DIAGRAM_ROW", "Data Series $(ROW)")
 
-#define RID_SVXSTR_DRIVER_NAME                      NC_("RID_SVXSTR_DRIVER_NAME", "Driver name")
-#define RID_SVXSTR_POOLED_FLAG                      NC_("RID_SVXSTR_POOLED_FLAG", "Pool")
-#define RID_SVXSTR_POOL_TIMEOUT                     NC_("RID_SVXSTR_POOL_TIMEOUT", "Timeout")
 #define RID_SVXSTR_YES                              NC_("RID_SVXSTR_YES", "Yes")
 #define RID_SVXSTR_NO                               NC_("RID_SVXSTR_NO", "No")
 
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx
index 204abfb8f433..c26f7a56db85 100644
--- a/cui/source/options/connpooloptions.cxx
+++ b/cui/source/options/connpooloptions.cxx
@@ -33,81 +33,7 @@ using ::svt::EditBrowseBox;
 
 namespace offapp
 {
-    /// Widget for the Connection Pool options page
-    class DriverListControl : public EditBrowseBox
-    {
-        using Window::Update;
-    protected:
-        DriverPoolingSettings                   m_aSavedSettings;
-        DriverPoolingSettings                   m_aSettings;
-        DriverPoolingSettings::const_iterator   m_aSeekRow;
-
-        OUString                                m_sYes;
-        OUString                                m_sNo;
-
-        Link<const DriverPooling*,void>               m_aRowChangeHandler;
-
-    public:
-        explicit DriverListControl(vcl::Window* _pParent);
-
-        virtual void Init() override;
-                void Update(const DriverPoolingSettings& _rSettings);
-        virtual OUString GetCellText( long nRow, sal_uInt16 nColId ) const override;
-
-        // the handler will be called with a DriverPoolingSettings::const_iterator as parameter,
-        // or NULL if no valid current row exists
-        void SetRowChangeHandler(const Link<const DriverPooling*,void>& _rHdl) { m_aRowChangeHandler = _rHdl; }
-
-        DriverPooling* getCurrentRow();
-        void                                    updateCurrentRow();
-
-        const DriverPoolingSettings& getSettings() const { return m_aSettings; }
-
-        void        saveValue()             { m_aSavedSettings = m_aSettings; }
-        bool    isModified() const;
-
-    protected:
-        virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) override;
-        virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) override;
-
-        virtual void PaintCell( OutputDevice& rDev, const ::tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
-
-        virtual bool SeekRow( long nRow ) override;
-        virtual bool SaveModified() override;
-
-        virtual bool IsTabAllowed(bool _bForward) const override;
-
-        virtual void StateChanged( StateChangedType nStateChange ) override;
-
-        virtual void CursorMoved() override;
-
-    protected:
-        virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
-
-
-    private:
-        OUString implGetCellText(const DriverPoolingSettings::const_iterator& _rPos, sal_uInt16 _nColId) const;
-    };
-
-    DriverListControl::DriverListControl(vcl::Window* _pParent)
-        :EditBrowseBox(_pParent, EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT, WB_BORDER,
-                       BrowserMode::AUTO_VSCROLL | BrowserMode::AUTO_HSCROLL | BrowserMode::HIDECURSOR | BrowserMode::AUTOSIZE_LASTCOL | BrowserMode::KEEPHIGHLIGHT)
-        ,m_aSeekRow(m_aSettings.end())
-        ,m_sYes(CuiResId(RID_SVXSTR_YES))
-        ,m_sNo(CuiResId(RID_SVXSTR_NO))
-    {
-        SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL);
-    }
-
-    VCL_BUILDER_FACTORY(DriverListControl)
-
-    bool DriverListControl::IsTabAllowed(bool /*_bForward*/) const
-    {
-        // no travelling within the fields via RETURN and TAB
-        return false;
-    }
-
-    bool DriverListControl::isModified() const
+    bool ConnectionPoolOptionsPage::isModifiedDriverList() const
     {
         if (m_aSettings.size() != m_aSavedSettings.size())
             return true;
@@ -123,220 +49,88 @@ namespace offapp
         return false;
     }
 
-
-    void DriverListControl::Init()
+    ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(TabPageParent pParent, const SfxItemSet& _rAttrSet)
+        : SfxTabPage(pParent, "cui/ui/connpooloptions.ui", "ConnPoolPage", &_rAttrSet)
+        , m_sYes(CuiResId(RID_SVXSTR_YES))
+        , m_sNo(CuiResId(RID_SVXSTR_NO))
+        , m_xEnablePooling(m_xBuilder->weld_check_button("connectionpooling"))
+        , m_xDriversLabel(m_xBuilder->weld_label("driverslabel"))
+        , m_xDriverList(m_xBuilder->weld_tree_view("driverlist"))
+        , m_xDriverLabel(m_xBuilder->weld_label("driverlabel"))
+        , m_xDriver(m_xBuilder->weld_label("driver"))
+        , m_xDriverPoolingEnabled(m_xBuilder->weld_check_button("enablepooling"))
+        , m_xTimeoutLabel(m_xBuilder->weld_label("timeoutlabel"))
+        , m_xTimeout(m_xBuilder->weld_spin_button("timeout"))
     {
-        EditBrowseBox::Init();
-
-        Size aColWidth = LogicToPixel(Size(160, 0), MapMode(MapUnit::MapAppFont));
-        InsertDataColumn(1, CuiResId(RID_SVXSTR_DRIVER_NAME), aColWidth.Width());
-        aColWidth = LogicToPixel(Size(30, 0), MapMode(MapUnit::MapAppFont));
-        InsertDataColumn(2, CuiResId(RID_SVXSTR_POOLED_FLAG), aColWidth.Width());
-        aColWidth = LogicToPixel(Size(60, 0), MapMode(MapUnit::MapAppFont));
-        InsertDataColumn(3, CuiResId(RID_SVXSTR_POOL_TIMEOUT), aColWidth.Width());
-            // Attention: the resource of the string is local to the resource of the enclosing dialog!
-    }
+        m_xDriverList->set_size_request(m_xDriverList->get_approximate_digit_width() * 60,
+                                        m_xDriverList->get_height_rows(15));
+        m_xDriverList->show();
 
+        std::vector<int> aWidths;
+        aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 50);
+        aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 8);
+        m_xDriverList->set_column_fixed_widths(aWidths);
 
-    void DriverListControl::CursorMoved()
-    {
-        EditBrowseBox::CursorMoved();
+        m_xEnablePooling->connect_clicked( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+        m_xDriverPoolingEnabled->connect_clicked( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
 
-        // call the row change handler
-        if ( m_aRowChangeHandler.IsSet() )
-        {
-            if ( GetCurRow() >= 0 )
-            {   // == -1 may happen in case the browse box has just been cleared
-                m_aRowChangeHandler.Call( getCurrentRow() );
-            }
-        }
+        m_xDriverList->connect_changed(LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged));
+        m_xTimeout->connect_value_changed(LINK(this, ConnectionPoolOptionsPage, OnSpinValueChanged));
     }
 
-    DriverPooling* DriverListControl::getCurrentRow()
+    void ConnectionPoolOptionsPage::updateRow(size_t nRow)
     {
-        OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
-            "DriverListControl::getCurrentRow: invalid current row!");
-
-        if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
-            return &(*(m_aSettings.begin() + GetCurRow()));
-
-        return nullptr;
-    }
-
-
-    void DriverListControl::updateCurrentRow()
-    {
-        Window::Invalidate( GetRowRectPixel( GetCurRow() ), InvalidateFlags::Update );
-    }
-
-
-    void DriverListControl::Update(const DriverPoolingSettings& _rSettings)
-    {
-        m_aSettings = _rSettings;
-
-        SetUpdateMode(false);
-        RowRemoved(0, GetRowCount());
-        RowInserted(0, m_aSettings.size());
-        SetUpdateMode(true);
-
-        ActivateCell(1, 0);
-    }
-
-
-    sal_uInt32 DriverListControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId)
-    {
-        return GetDataWindow().GetTextWidth(GetCellText(nRow, nColId));
-    }
-
-
-    OUString DriverListControl::implGetCellText(const DriverPoolingSettings::const_iterator& _rPos, sal_uInt16 _nColId) const
-    {
-        OSL_ENSURE(_rPos < m_aSettings.end(), "DriverListControl::implGetCellText: invalid position!");
-
-        OUString sReturn;
-        switch (_nColId)
-        {
-            case 1:
-                sReturn = _rPos->sName;
-                break;
-            case 2:
-                sReturn = _rPos->bEnabled ? m_sYes : m_sNo;
-                break;
-            case 3:
-                if (_rPos->bEnabled)
-                    sReturn = OUString::number(_rPos->nTimeoutSeconds);
-                break;
-            default:
-                OSL_FAIL("DriverListControl::implGetCellText: invalid column id!");
-        }
-        return sReturn;
-    }
-
-
-    void DriverListControl::StateChanged( StateChangedType nStateChange )
-    {
-        if (StateChangedType::Enable == nStateChange)
-            Window::Invalidate(InvalidateFlags::Update);
-        EditBrowseBox::StateChanged( nStateChange );
-    }
-
-
-    OUString DriverListControl::GetCellText( long nRow, sal_uInt16 nColId ) const
-    {
-        OUString sReturn;
-        if (nRow > m_aSettings.size())
+        auto const& currentSetting = m_aSettings[nRow];
+        m_xDriverList->set_text(nRow, currentSetting.sName, 0);
+        if (currentSetting.bEnabled)
         {
-            OSL_FAIL("DriverListControl::GetCellText: don't ask me for such rows!");
+            m_xDriverList->set_text(nRow, m_sYes, 1);
+            m_xDriverList->set_text(nRow, OUString::number(currentSetting.nTimeoutSeconds), 2);
         }
         else
         {
-            sReturn = implGetCellText(m_aSettings.begin() + nRow, nColId);
+            m_xDriverList->set_text(nRow, m_sNo, 1);
+            m_xDriverList->set_text(nRow, "-", 2);
         }
-        return sReturn;
     }
 
-
-    void DriverListControl::InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol )
-    {
-        rController->GetWindow().SetText(GetCellText(nRow, nCol));
-    }
-
-
-    ::svt::CellController* DriverListControl::GetController( long /*nRow*/, sal_uInt16 /*nCol*/ )
-    {
-        return nullptr;
-    }
-
-
-    bool DriverListControl::SaveModified()
+    void ConnectionPoolOptionsPage::updateCurrentRow()
     {
-        return true;
+        int nRow = m_xDriverList->get_selected_index();
+        if (nRow == -1)
+            return;
+        updateRow(nRow);
     }
 
-
-    bool DriverListControl::SeekRow( long _nRow )
+    void ConnectionPoolOptionsPage::UpdateDriverList(const DriverPoolingSettings& _rSettings)
     {
-        EditBrowseBox::SeekRow(_nRow);
-
-        if (_nRow < m_aSettings.size())
-            m_aSeekRow = m_aSettings.begin() + _nRow;
-        else
-            m_aSeekRow = m_aSettings.end();
-
-        return m_aSeekRow != m_aSettings.end();
-    }
+        m_aSettings = _rSettings;
 
+        m_xDriverList->freeze();
+        m_xDriverList->clear();
 
-    void DriverListControl::PaintCell( OutputDevice& rDev, const ::tools::Rectangle& rRect, sal_uInt16 nColId ) const
-    {
-        OSL_ENSURE(m_aSeekRow != m_aSettings.end(), "DriverListControl::PaintCell: invalid row!");
-
-        if (m_aSeekRow != m_aSettings.end())
+        for (size_t i = 0; i < m_aSettings.size(); ++i)
         {
-            rDev.SetClipRegion(vcl::Region(rRect));
-
-            DrawTextFlags nStyle = DrawTextFlags::Clip;
-            if (!IsEnabled())
-                nStyle |= DrawTextFlags::Disable;
-            switch (nColId)
-            {
-                case 1: nStyle |= DrawTextFlags::Left; break;
-                case 2:
-                case 3: nStyle |= DrawTextFlags::Center; break;
-            }
+            m_xDriverList->append();
+            updateRow(i);
+        }
 
-            rDev.DrawText(rRect, implGetCellText(m_aSeekRow, nColId), nStyle);
+        m_xDriverList->thaw();
 
-            rDev.SetClipRegion();
+        if (!m_aSettings.empty())
+        {
+            m_xDriverList->select(0);
+            OnDriverRowChanged(*m_xDriverList);
         }
     }
 
-    ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(vcl::Window* _pParent, const SfxItemSet& _rAttrSet)
-        : SfxTabPage(_pParent, "ConnPoolPage", "cui/ui/connpooloptions.ui", &_rAttrSet)
-    {
-        get(m_pEnablePooling, "connectionpooling");
-        get(m_pDriversLabel, "driverslabel");
-        get(m_pDriverList, "driverlist");
-        get(m_pDriverLabel, "driverlabel");
-        get(m_pDriver, "driver");
-        get(m_pDriverPoolingEnabled, "enablepooling");
-        get(m_pTimeoutLabel, "timeoutlabel");
-        get(m_pTimeout, "timeout");
-
-        Size aControlSize(248, 100);
-        aControlSize = LogicToPixel(aControlSize, MapMode(MapUnit::MapAppFont));
-        m_pDriverList->set_width_request(aControlSize.Width());
-        m_pDriverList->set_height_request(aControlSize.Height());
-        m_pDriverList->Init();
-        m_pDriverList->Show();
-
-        m_pEnablePooling->SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
-        m_pDriverPoolingEnabled->SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
-
-        m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) );
-    }
-
     ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage()
     {
-        disposeOnce();
     }
 
-    void ConnectionPoolOptionsPage::dispose()
+    VclPtr<SfxTabPage> ConnectionPoolOptionsPage::Create(TabPageParent pParent, const SfxItemSet* _rAttrSet)
     {
-        m_pEnablePooling.clear();
-        m_pDriversLabel.clear();
-        m_pDriverList.clear();
-        m_pDriverLabel.clear();
-        m_pDriver.clear();
-        m_pDriverPoolingEnabled.clear();
-        m_pTimeoutLabel.clear();
-        m_pTimeout.clear();
-        SfxTabPage::dispose();
-    }
-
-    VclPtr<SfxTabPage> ConnectionPoolOptionsPage::Create(TabPageParent _pParent, const SfxItemSet* _rAttrSet)
-    {
-        return VclPtr<ConnectionPoolOptionsPage>::Create(_pParent.pParent, *_rAttrSet);
+        return VclPtr<ConnectionPoolOptionsPage>::Create(pParent, *_rAttrSet);
     }
 
     void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet)
@@ -344,128 +138,124 @@ namespace offapp
         // the enabled flag
         const SfxBoolItem* pEnabled = _rSet.GetItem<SfxBoolItem>(SID_SB_POOLING_ENABLED);
         OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
-        m_pEnablePooling->Check(pEnabled == nullptr || pEnabled->GetValue());
+        m_xEnablePooling->set_active(pEnabled == nullptr || pEnabled->GetValue());
 
-        m_pEnablePooling->SaveValue();
+        m_xEnablePooling->save_state();
 
         // the settings for the single drivers
         const DriverPoolingSettingsItem* pDriverSettings = _rSet.GetItem<DriverPoolingSettingsItem>(SID_SB_DRIVER_TIMEOUTS);
         if (pDriverSettings)
-            m_pDriverList->Update(pDriverSettings->getSettings());
+            UpdateDriverList(pDriverSettings->getSettings());
         else
         {
             OSL_FAIL("ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
-            m_pDriverList->Update(DriverPoolingSettings());
+            UpdateDriverList(DriverPoolingSettings());
         }
-        m_pDriverList->saveValue();
+        saveDriverList();
 
         // reflect the new settings
-        OnEnabledDisabled(m_pEnablePooling);
+        OnEnabledDisabled(*m_xEnablePooling);
     }
 
-
-    bool ConnectionPoolOptionsPage::EventNotify( NotifyEvent& _rNEvt )
+    IMPL_LINK_NOARG(ConnectionPoolOptionsPage, OnSpinValueChanged, weld::SpinButton&, void)
     {
-        if (MouseNotifyEvent::LOSEFOCUS == _rNEvt.GetType())
-            if (m_pTimeout->IsWindowOrChild(_rNEvt.GetWindow()))
-                commitTimeoutField();
-
-        return SfxTabPage::EventNotify(_rNEvt);
+        commitTimeoutField();
     }
 
-
     bool ConnectionPoolOptionsPage::FillItemSet(SfxItemSet* _rSet)
     {
         commitTimeoutField();
 
         bool bModified = false;
         // the enabled flag
-        if (m_pEnablePooling->IsValueChangedFromSaved())
+        if (m_xEnablePooling->get_state_changed_from_saved())
         {
-            _rSet->Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_pEnablePooling->IsChecked()));
+            _rSet->Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_xEnablePooling->get_active()));
             bModified = true;
         }
 
         // the settings for the single drivers
-        if (m_pDriverList->isModified())
+        if (isModifiedDriverList())
         {
-            _rSet->Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_pDriverList->getSettings()));
+            _rSet->Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_aSettings));
             bModified = true;
         }
 
         return bModified;
     }
 
-
     void ConnectionPoolOptionsPage::ActivatePage( const SfxItemSet& _rSet)
     {
         SfxTabPage::ActivatePage(_rSet);
         implInitControls(_rSet);
     }
 
-
     void ConnectionPoolOptionsPage::Reset(const SfxItemSet* _rSet)
     {
         implInitControls(*_rSet);
     }
 
-
-    IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const DriverPooling*, pDriverPos, void )
+    IMPL_LINK_NOARG(ConnectionPoolOptionsPage, OnDriverRowChanged, weld::TreeView&, void)
     {
-        bool bValidRow = (nullptr != pDriverPos);
-        m_pDriverPoolingEnabled->Enable(bValidRow && m_pEnablePooling->IsChecked());
-        m_pTimeoutLabel->Enable(bValidRow);
-        m_pTimeout->Enable(bValidRow);
+        const int nDriverPos = m_xDriverList->get_selected_index();
+        bool bValidRow = (nDriverPos != -1);
+        m_xDriverPoolingEnabled->set_sensitive(bValidRow && m_xEnablePooling->get_active());
+        m_xTimeoutLabel->set_sensitive(bValidRow);
+        m_xTimeout->set_sensitive(bValidRow);
 
         if (!bValidRow)
         {   // positioned on an invalid row
-            m_pDriver->SetText(OUString());
+            m_xDriver->set_label(OUString());
         }
         else
         {
-            m_pDriver->SetText(pDriverPos->sName);
-            m_pDriverPoolingEnabled->Check(pDriverPos->bEnabled);
-            m_pTimeout->SetText(OUString::number(pDriverPos->nTimeoutSeconds));
+            auto const& currentSetting = m_aSettings[nDriverPos];
+            m_xDriver->set_label(currentSetting.sName);
+            m_xDriverPoolingEnabled->set_active(currentSetting.bEnabled);
+            m_xTimeout->set_value(currentSetting.nTimeoutSeconds);
 
-            OnEnabledDisabled(m_pDriverPoolingEnabled);
+            OnEnabledDisabled(*m_xDriverPoolingEnabled);
         }
     }
 
-
     void ConnectionPoolOptionsPage::commitTimeoutField()
     {
-        if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow())
-        {
-            pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_pTimeout->GetValue());
-            m_pDriverList->updateCurrentRow();
-        }
+        const int nDriverPos = m_xDriverList->get_selected_index();
+        if (nDriverPos == -1)
+            return;
+        m_aSettings[nDriverPos].nTimeoutSeconds = m_xTimeout->get_value();
+        updateCurrentRow();
     }
 
-
-    IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, Button*, _pCheckBox, void )
+    IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, weld::Button&, rCheckBox, void )
     {
-        bool bGloballyEnabled = m_pEnablePooling->IsChecked();
-        bool bLocalDriverChanged = m_pDriverPoolingEnabled == _pCheckBox;
+        bool bGloballyEnabled = m_xEnablePooling->get_active();
+        bool bLocalDriverChanged = m_xDriverPoolingEnabled.get() == &rCheckBox;
 
-        if (m_pEnablePooling == _pCheckBox)
+        if (m_xEnablePooling.get() == &rCheckBox)
         {
-            m_pDriversLabel->Enable(bGloballyEnabled);
-            m_pDriverList->Enable(bGloballyEnabled);
-            m_pDriverLabel->Enable(bGloballyEnabled);
-            m_pDriver->Enable(bGloballyEnabled);
-            m_pDriverPoolingEnabled->Enable(bGloballyEnabled);
+            m_xDriversLabel->set_sensitive(bGloballyEnabled);
+            m_xDriverList->set_sensitive(bGloballyEnabled);
+            if (!bGloballyEnabled)
+                m_xDriverList->select(-1);
+            m_xDriverLabel->set_sensitive(bGloballyEnabled);
+            m_xDriver->set_sensitive(bGloballyEnabled);
+            m_xDriverPoolingEnabled->set_sensitive(bGloballyEnabled);
         }
         else
             OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
 
-        m_pTimeoutLabel->Enable(bGloballyEnabled && m_pDriverPoolingEnabled->IsChecked());
-        m_pTimeout->Enable(bGloballyEnabled && m_pDriverPoolingEnabled->IsChecked());
+        m_xTimeoutLabel->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
+        m_xTimeout->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
 
         if (bLocalDriverChanged)
         {
             // update the list
-            m_pDriverList->getCurrentRow()->bEnabled = m_pDriverPoolingEnabled->IsChecked();
-            m_pDriverList->updateCurrentRow();
+            const int nDriverPos = m_xDriverList->get_selected_index();
+            if (nDriverPos == -1)
+                return;
+            m_aSettings[nDriverPos].bEnabled = m_xDriverPoolingEnabled->get_active();
+            updateCurrentRow();
         }
     }
 
diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx
index ffd8f9702d39..37bb0378d667 100644
--- a/cui/source/options/connpooloptions.hxx
+++ b/cui/source/options/connpooloptions.hxx
@@ -21,44 +21,48 @@
 #define INCLUDED_CUI_SOURCE_OPTIONS_CONNPOOLOPTIONS_HXX
 
 #include <sfx2/tabdlg.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
-#include <vcl/field.hxx>
 
+#include "connpoolsettings.hxx"
 
 namespace offapp
 {
-
-    struct DriverPooling;
-    class DriverListControl;
     class ConnectionPoolOptionsPage final : public SfxTabPage
     {
         using TabPage::ActivatePage;
 
-        VclPtr<CheckBox>               m_pEnablePooling;
-        VclPtr<FixedText>              m_pDriversLabel;
-        VclPtr<DriverListControl>      m_pDriverList;
-        VclPtr<FixedText>              m_pDriverLabel;
-        VclPtr<FixedText>              m_pDriver;
-        VclPtr<CheckBox>               m_pDriverPoolingEnabled;
-        VclPtr<FixedText>              m_pTimeoutLabel;
-        VclPtr<NumericField>           m_pTimeout;
+        OUString m_sYes;
+        OUString m_sNo;
+        DriverPoolingSettings m_aSettings;
+        DriverPoolingSettings m_aSavedSettings;
+
+        std::unique_ptr<weld::CheckButton> m_xEnablePooling;
+        std::unique_ptr<weld::Label> m_xDriversLabel;
+        std::unique_ptr<weld::TreeView> m_xDriverList;
+        std::unique_ptr<weld::Label> m_xDriverLabel;
+        std::unique_ptr<weld::Label> m_xDriver;
+        std::unique_ptr<weld::CheckButton> m_xDriverPoolingEnabled;
+        std::unique_ptr<weld::Label> m_xTimeoutLabel;
+        std::unique_ptr<weld::SpinButton> m_xTimeout;
 
     public:
-        ConnectionPoolOptionsPage(vcl::Window* _pParent, const SfxItemSet& _rAttrSet);
+        ConnectionPoolOptionsPage(TabPageParent _pParent, const SfxItemSet& _rAttrSet);
         virtual ~ConnectionPoolOptionsPage() override;
-        virtual void dispose() override;
         static VclPtr<SfxTabPage>  Create(TabPageParent _pParent, const SfxItemSet* _rAttrSet);
 
     private:
-        virtual bool        EventNotify( NotifyEvent& _rNEvt ) override;
-
         virtual bool        FillItemSet(SfxItemSet* _rSet) override;
         virtual void        Reset(const SfxItemSet* _rSet) override;
         virtual void        ActivatePage( const SfxItemSet& _rSet) override;
 
-        DECL_LINK( OnEnabledDisabled, Button*, void );
-        DECL_LINK( OnDriverRowChanged, const DriverPooling*, void );
+        void updateRow(size_t nRow);
+        void updateCurrentRow();
+        void UpdateDriverList(const DriverPoolingSettings& _rSettings);
+        bool isModifiedDriverList() const;
+        void saveDriverList() { m_aSavedSettings = m_aSettings; }
+
+        DECL_LINK(OnEnabledDisabled, weld::Button&, void);
+        DECL_LINK(OnSpinValueChanged, weld::SpinButton&, void);
+        DECL_LINK(OnDriverRowChanged, weld::TreeView&, void);
 
         void implInitControls(const SfxItemSet& _rSet);
 
diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx
index d5bd7e336a7d..153ff94597e4 100644
--- a/cui/source/options/connpoolsettings.hxx
+++ b/cui/source/options/connpoolsettings.hxx
@@ -54,7 +54,9 @@ namespace offapp
 
         DriverPoolingSettings();
 
-        sal_Int32 size() const { return m_aDrivers.size(); }
+        size_t size() const { return m_aDrivers.size(); }
+        DriverPooling& operator[]( size_t nPos ) { return m_aDrivers[nPos]; }
+        bool empty() const { return m_aDrivers.empty(); }
 
         const_iterator  begin() const   { return m_aDrivers.begin(); }
         const_iterator  end() const     { return m_aDrivers.end(); }
diff --git a/cui/uiconfig/ui/connpooloptions.ui b/cui/uiconfig/ui/connpooloptions.ui
index 9896c3fdcb19..14b92a30346a 100644
--- a/cui/uiconfig/ui/connpooloptions.ui
+++ b/cui/uiconfig/ui/connpooloptions.ui
@@ -1,8 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">30</property>
+    <property name="upper">600</property>
+    <property name="value">60</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name text1 -->
+      <column type="gchararray"/>
+      <!-- column-name text2 -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkGrid" id="ConnPoolPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -47,8 +63,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -63,29 +77,14 @@
                       <object class="GtkLabel" id="driverslabel">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="connpooloptions|driverslabel">Drivers known in %PRODUCTNAME</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">driverlist</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="cuilo-DriverListControl" id="driverlist">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="vexpand">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -97,8 +96,8 @@
                           <object class="GtkLabel" id="driverlabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="connpooloptions|driverlabel">Current driver:</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -123,8 +122,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -140,8 +137,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -154,10 +149,10 @@
                           <object class="GtkLabel" id="timeoutlabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="connpooloptions|timeoutlabel">_Timeout (seconds)</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">timeout</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -169,7 +164,8 @@
                           <object class="GtkSpinButton" id="timeout">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="no">60</property>
+                            <property name="activates_default">True</property>
+                            <property name="text">60</property>
                             <property name="adjustment">adjustment1</property>
                             <property name="value">60</property>
                           </object>
@@ -183,16 +179,93 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">4</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkScrolledWindow" id="driverlistscroll">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="driverlist">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="hexpand">True</property>
+                                <property name="vexpand">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-selection2"/>
+                                </child>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+                                    <property name="resizable">True</property>
+                                    <property name="spacing">6</property>
+                                    <property name="title" translatable="yes" context="connpooloptions|drivername">Driver name</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderer4"/>
+                                      <attributes>
+                                        <attribute name="text">0</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+                                    <property name="resizable">True</property>
+                                    <property name="spacing">6</property>
+                                    <property name="title" translatable="yes" context="connpooloptions|pool">Pool</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderer9"/>
+                                      <attributes>
+                                        <attribute name="text">1</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+                                    <property name="resizable">True</property>
+                                    <property name="spacing">6</property>
+                                    <property name="title" translatable="yes" context="connpooloptions|timeout">Timeout</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderer7"/>
+                                      <attributes>
+                                        <attribute name="text">2</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
@@ -213,16 +286,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
       </packing>
     </child>
   </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="lower">30</property>
-    <property name="upper">600</property>
-    <property name="value">60</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
 </interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 4ada0543e8ad..50d27c0fd3ae 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -290,10 +290,6 @@
                         generic-name="Template Icon View" parent="GtkIconView"
                         icon-name="widget-gtk-iconview"/>
 
-    <glade-widget-class title="Driver List Control" name="cuilo-DriverListControl"
-                        generic-name="DriverListControl" parent="GtkEntry"
-                        icon-name="widget-gtk-combobox"/>
-
     <glade-widget-class title="DataTreeListBox" name="svxcorelo-DataTreeListBox"
                         generic-name="DataTreeListBox" parent="GtkTreeView"
                         icon-name="widget-gtk-treeview"/>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index d6d90b3caac1..a1bdb4f2c9ba 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -462,7 +462,6 @@ custom_widgets = [
     'ContextVBox',
     'CustomAnimationList',
     'DataTreeListBox',
-    'DriverListControl',
     'DropdownBox',
     'EmojiView',
     'FontNameBox',


More information about the Libreoffice-commits mailing list