21#include <osl/diagnose.h>
39 if (currentSetting != *aSaved)
48 :
SfxTabPage(pPage, pController,
"cui/ui/connpooloptions.ui",
"ConnPoolPage", &_rAttrSet)
51 , m_xEnablePooling(m_xBuilder->weld_check_button(
"connectionpooling"))
52 , m_xDriversLabel(m_xBuilder->weld_label(
"driverslabel"))
53 , m_xDriverList(m_xBuilder->weld_tree_view(
"driverlist"))
54 , m_xDriverLabel(m_xBuilder->weld_label(
"driverlabel"))
55 , m_xDriver(m_xBuilder->weld_label(
"driver"))
56 , m_xDriverPoolingEnabled(m_xBuilder->weld_check_button(
"enablepooling"))
57 , m_xTimeoutLabel(m_xBuilder->weld_label(
"timeoutlabel"))
58 , m_xTimeout(m_xBuilder->weld_spin_button(
"timeout"))
64 std::vector<int> aWidths
66 o3tl::narrowing<int>(
m_xDriverList->get_approximate_digit_width() * 50),
67 o3tl::narrowing<int>(
m_xDriverList->get_approximate_digit_width() * 8)
82 if (currentSetting.bEnabled)
85 m_xDriverList->set_text(nRow, OUString::number(currentSetting.nTimeoutSeconds), 2);
130 return std::make_unique<ConnectionPoolOptionsPage>(pPage, pController, *_rAttrSet);
137 OSL_ENSURE(pEnabled,
"ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
148 SAL_WARN(
"cui.options",
"ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
159 commitTimeoutField();
166 bool bModified =
false;
197 const int nDriverPos = m_xDriverList->get_selected_index();
198 bool bValidRow = (nDriverPos != -1);
199 m_xDriverPoolingEnabled->set_sensitive(bValidRow && m_xEnablePooling->get_active());
200 m_xTimeoutLabel->set_sensitive(bValidRow);
201 m_xTimeout->set_sensitive(bValidRow);
205 m_xDriver->set_label(OUString());
209 auto const& currentSetting =
m_aSettings[nDriverPos];
210 m_xDriver->set_label(currentSetting.sName);
211 m_xDriverPoolingEnabled->set_active(currentSetting.bEnabled);
212 m_xTimeout->set_value(currentSetting.nTimeoutSeconds);
214 OnEnabledDisabled(*m_xDriverPoolingEnabled);
221 if (nDriverPos == -1)
229 bool bGloballyEnabled = m_xEnablePooling->get_active();
230 bool bLocalDriverChanged = m_xDriverPoolingEnabled.get() == &rCheckBox;
232 if (m_xEnablePooling.get() == &rCheckBox)
234 m_xDriversLabel->set_sensitive(bGloballyEnabled);
235 m_xDriverList->set_sensitive(bGloballyEnabled);
236 if (!bGloballyEnabled)
237 m_xDriverList->select(-1);
238 m_xDriverLabel->set_sensitive(bGloballyEnabled);
239 m_xDriver->set_sensitive(bGloballyEnabled);
240 m_xDriverPoolingEnabled->set_sensitive(bGloballyEnabled);
243 OSL_ENSURE(bLocalDriverChanged,
"ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
245 m_xTimeoutLabel->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
246 m_xTimeout->set_sensitive(bGloballyEnabled && m_xDriverPoolingEnabled->get_active());
248 if (bLocalDriverChanged)
251 const int nDriverPos = m_xDriverList->get_selected_index();
252 if (nDriverPos == -1)
254 m_aSettings[nDriverPos].bEnabled = m_xDriverPoolingEnabled->get_active();
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual void ActivatePage(const SfxItemSet &)
std::unique_ptr< weld::TreeView > m_xDriverList
DriverPoolingSettings m_aSettings
void implInitControls(const SfxItemSet &_rSet)
std::unique_ptr< weld::SpinButton > m_xTimeout
virtual void Reset(const SfxItemSet *_rSet) override
virtual void ActivatePage(const SfxItemSet &_rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
void updateRow(size_t nRow)
void UpdateDriverList(const DriverPoolingSettings &_rSettings)
bool isModifiedDriverList() const
virtual ~ConnectionPoolOptionsPage() override
std::unique_ptr< weld::CheckButton > m_xDriverPoolingEnabled
ConnectionPoolOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rAttrSet)
virtual bool FillItemSet(SfxItemSet *_rSet) override
DriverPoolingSettings m_aSavedSettings
std::unique_ptr< weld::CheckButton > m_xEnablePooling
void commitTimeoutField()
const DriverPoolingSettings & getSettings() const
const_iterator begin() const
DriverSettings::const_iterator const_iterator
OUString CuiResId(TranslateId aKey)
#define SID_SB_DRIVER_TIMEOUTS
#define SID_SB_POOLING_ENABLED
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
IMPL_LINK(ConnectionPoolOptionsPage, OnEnabledDisabled, weld::Toggleable &, rCheckBox, void)
IMPL_LINK_NOARG(ConnectionPoolOptionsPage, OnSpinValueChanged, weld::SpinButton &, void)
::comphelper::NamedValueCollection m_aSettings