20 #include <osl/diagnose.h>
26 #include <strings.hrc>
27 #include <dialmgr.hxx>
29 using ::svt::EditBrowseBox;
41 if (currentSetting != *aSaved)
50 :
SfxTabPage(pPage, pController,
"cui/ui/connpooloptions.ui",
"ConnPoolPage", &_rAttrSet)
53 , m_xEnablePooling(m_xBuilder->weld_check_button(
"connectionpooling"))
54 , m_xDriversLabel(m_xBuilder->weld_label(
"driverslabel"))
55 , m_xDriverList(m_xBuilder->weld_tree_view(
"driverlist"))
56 , m_xDriverLabel(m_xBuilder->weld_label(
"driverlabel"))
57 , m_xDriver(m_xBuilder->weld_label(
"driver"))
58 , m_xDriverPoolingEnabled(m_xBuilder->weld_check_button(
"enablepooling"))
59 , m_xTimeoutLabel(m_xBuilder->weld_label(
"timeoutlabel"))
60 , m_xTimeout(m_xBuilder->weld_spin_button(
"timeout"))
66 std::vector<int> aWidths;
67 aWidths.push_back(
m_xDriverList->get_approximate_digit_width() * 50);
68 aWidths.push_back(
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 OSL_FAIL(
"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();
#define LINK(Instance, Class, Member)
DriverSettings::const_iterator const_iterator
virtual ~ConnectionPoolOptionsPage() override
std::unique_ptr< weld::CheckButton > m_xDriverPoolingEnabled
virtual void Reset(const SfxItemSet *_rSet) override
#define SID_SB_POOLING_ENABLED
virtual void ActivatePage(const SfxItemSet &)
void commitTimeoutField()
std::unique_ptr< weld::TreeView > m_xDriverList
#define SID_SB_DRIVER_TIMEOUTS
IMPL_LINK(ConnectionPoolOptionsPage, OnEnabledDisabled, weld::Button &, rCheckBox, void)
DriverPoolingSettings m_aSavedSettings
const DriverPoolingSettings & getSettings() const
std::unique_ptr< weld::CheckButton > m_xEnablePooling
void UpdateDriverList(const DriverPoolingSettings &_rSettings)
DriverPoolingSettings m_aSettings
ConnectionPoolOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rAttrSet)
IMPL_LINK_NOARG(ConnectionPoolOptionsPage, OnSpinValueChanged, weld::SpinButton &, void)
OUString CuiResId(const char *pKey)
::comphelper::NamedValueCollection m_aSettings
void updateRow(size_t nRow)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::SpinButton > m_xTimeout
virtual bool FillItemSet(SfxItemSet *_rSet) override
virtual void ActivatePage(const SfxItemSet &_rSet) override
void implInitControls(const SfxItemSet &_rSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
const_iterator begin() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
bool isModifiedDriverList() const