diff options
author | Jan Holesovsky <kendy@collabora.com> | 2013-09-29 14:42:38 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-09-29 14:49:43 +0200 |
commit | 33ad001fe6c19fed72129b24b3dd85d8eff05baf (patch) | |
tree | e60302603fe267a5eda8008e838d77a0f7d40b37 /cui/source/options | |
parent | b84c89bb2ab5c2ac8e4bf2efff9db2d6cf26c401 (diff) |
Convert connpooloptions to .ui + adapt code.
Change-Id: Idf76635180f73716f3d476975d9738edad464348
Diffstat (limited to 'cui/source/options')
-rw-r--r-- | cui/source/options/connpooloptions.cxx | 133 | ||||
-rw-r--r-- | cui/source/options/connpooloptions.hrc | 41 | ||||
-rw-r--r-- | cui/source/options/connpooloptions.hxx | 27 | ||||
-rw-r--r-- | cui/source/options/connpooloptions.src | 120 |
4 files changed, 90 insertions, 231 deletions
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx index bf64607c80f0..d154b0f03b8a 100644 --- a/cui/source/options/connpooloptions.cxx +++ b/cui/source/options/connpooloptions.cxx @@ -18,7 +18,6 @@ */ #include "connpooloptions.hxx" -#include "connpooloptions.hrc" #include <svtools/editbrowsebox.hxx> #include <vcl/field.hxx> #include "connpoolsettings.hxx" @@ -27,16 +26,12 @@ #include "helpid.hrc" #include <dialmgr.hxx> -//........................................................................ +using ::svt::EditBrowseBox; + namespace offapp { -//........................................................................ - - //==================================================================== - //= DriverListControl - //==================================================================== - typedef ::svt::EditBrowseBox DriverListControl_Base; - class DriverListControl : public DriverListControl_Base + /// Widget for the Connection Pool options page + class DriverListControl : public EditBrowseBox { using Window::Update; protected: @@ -50,7 +45,7 @@ namespace offapp Link m_aRowChangeHandler; public: - DriverListControl( Window* _pParent, const ResId& _rId); + DriverListControl(Window* _pParent); virtual void Init(); void Update(const DriverPoolingSettings& _rSettings); @@ -94,11 +89,11 @@ namespace offapp }; //-------------------------------------------------------------------- - DriverListControl::DriverListControl( Window* _pParent, const ResId& _rId) - :DriverListControl_Base(_pParent, _rId, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL) + DriverListControl::DriverListControl(Window* _pParent) + :EditBrowseBox(_pParent, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL) ,m_aSeekRow(m_aSettings.end()) - ,m_sYes(ResId(STR_YES,*_rId.GetResMgr())) - ,m_sNo(ResId(STR_NO,*_rId.GetResMgr())) + ,m_sYes(CUI_RES(RID_SVXSTR_YES)) + ,m_sNo(CUI_RES(RID_SVXSTR_NO)) { SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL); @@ -106,6 +101,11 @@ namespace offapp GetDataWindow().SetHelpId(HID_OFA_CONNPOOL_DRIVERLIST); } + extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeDriverListControl(Window *pParent, VclBuilder::stringmap &) + { + return new DriverListControl(pParent); + } + //-------------------------------------------------------------------- sal_Bool DriverListControl::IsTabAllowed(sal_Bool /*_bForward*/) const { @@ -134,21 +134,21 @@ namespace offapp //-------------------------------------------------------------------- void DriverListControl::Init() { - DriverListControl_Base::Init(); + EditBrowseBox::Init(); Size aColWidth = LogicToPixel(Size(160, 0), MAP_APPFONT); - InsertDataColumn(1, String(CUI_RES(STR_DRIVER_NAME)), aColWidth.Width()); + InsertDataColumn(1, String(CUI_RES(RID_SVXSTR_DRIVER_NAME)), aColWidth.Width()); aColWidth = LogicToPixel(Size(30, 0), MAP_APPFONT); - InsertDataColumn(2, String(CUI_RES(STR_POOLED_FLAG)), aColWidth.Width()); + InsertDataColumn(2, String(CUI_RES(RID_SVXSTR_POOLED_FLAG)), aColWidth.Width()); aColWidth = LogicToPixel(Size(60, 0), MAP_APPFONT); - InsertDataColumn(3, String(CUI_RES(STR_POOL_TIMEOUT)), aColWidth.Width()); + InsertDataColumn(3, String(CUI_RES(RID_SVXSTR_POOL_TIMEOUT)), aColWidth.Width()); // Attention: the resource of the string is local to the resource of the enclosing dialog! } //-------------------------------------------------------------------- void DriverListControl::CursorMoved() { - DriverListControl_Base::CursorMoved(); + EditBrowseBox::CursorMoved(); // call the row change handler if ( m_aRowChangeHandler.IsSet() ) @@ -238,7 +238,7 @@ namespace offapp { if (STATE_CHANGE_ENABLE == nStateChange) Window::Invalidate(INVALIDATE_UPDATE); - DriverListControl_Base::StateChanged( nStateChange ); + EditBrowseBox::StateChanged( nStateChange ); } //-------------------------------------------------------------------- @@ -277,7 +277,7 @@ namespace offapp //-------------------------------------------------------------------- sal_Bool DriverListControl::SeekRow( long _nRow ) { - DriverListControl_Base::SeekRow(_nRow); + EditBrowseBox::SeekRow(_nRow); if (_nRow < m_aSettings.size()) m_aSeekRow = m_aSettings.begin() + _nRow; @@ -317,24 +317,26 @@ namespace offapp //==================================================================== //-------------------------------------------------------------------- ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet) - :SfxTabPage(_pParent, CUI_RES(RID_OFAPAGE_CONNPOOLOPTIONS ), _rAttrSet) - ,m_aFrame (this, CUI_RES(FL_POOLING)) - ,m_aEnablePooling (this, CUI_RES(CB_POOL_CONNS)) - ,m_aDriversLabel (this, CUI_RES(FT_DRIVERS)) - ,m_pDriverList(new DriverListControl(this, CUI_RES(CTRL_DRIVER_LIST))) - ,m_aDriverLabel (this, CUI_RES(FT_DRIVERLABEL)) - ,m_aDriver (this, CUI_RES(FT_DRIVER)) - ,m_aDriverPoolingEnabled(this, CUI_RES(CB_DRIVERPOOLING)) - ,m_aTimeoutLabel (this, CUI_RES(FT_TIMEOUT)) - ,m_aTimeout (this, CUI_RES(NF_TIMEOUT)) + : 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, MAP_APPFONT); + m_pDriverList->set_width_request(aControlSize.Width()); + m_pDriverList->set_height_request(aControlSize.Height()); m_pDriverList->Init(); m_pDriverList->Show(); - FreeResource(); - - m_aEnablePooling.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); - m_aDriverPoolingEnabled.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); + m_pEnablePooling->SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); + m_pDriverPoolingEnabled->SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) ); } @@ -346,20 +348,14 @@ namespace offapp } //-------------------------------------------------------------------- - ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage() - { - delete m_pDriverList; - } - - //-------------------------------------------------------------------- void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bFromReset*/) { // the enabled flag SFX_ITEMSET_GET( _rSet, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True ); OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!"); - m_aEnablePooling.Check(pEnabled ? pEnabled->GetValue() : sal_True); + m_pEnablePooling->Check(pEnabled ? pEnabled->GetValue() : sal_True); - m_aEnablePooling.SaveValue(); + m_pEnablePooling->SaveValue(); // the settings for the single drivers SFX_ITEMSET_GET( _rSet, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True ); @@ -373,14 +369,14 @@ namespace offapp m_pDriverList->saveValue(); // reflect the new settings - OnEnabledDisabled(&m_aEnablePooling); + OnEnabledDisabled(m_pEnablePooling); } //-------------------------------------------------------------------- long ConnectionPoolOptionsPage::Notify( NotifyEvent& _rNEvt ) { if (EVENT_LOSEFOCUS == _rNEvt.GetType()) - if (m_aTimeout.IsWindowOrChild(_rNEvt.GetWindow())) + if (m_pTimeout->IsWindowOrChild(_rNEvt.GetWindow())) commitTimeoutField(); return SfxTabPage::Notify(_rNEvt); @@ -393,9 +389,9 @@ namespace offapp sal_Bool bModified = sal_False; // the enabled flag - if (m_aEnablePooling.GetSavedValue() != m_aEnablePooling.IsChecked()) + if (m_pEnablePooling->GetSavedValue() != m_pEnablePooling->IsChecked()) { - _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_aEnablePooling.IsChecked()), SID_SB_POOLING_ENABLED); + _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_pEnablePooling->IsChecked()), SID_SB_POOLING_ENABLED); bModified = sal_True; } @@ -426,23 +422,23 @@ namespace offapp IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const void*, _pRowIterator ) { sal_Bool bValidRow = (NULL != _pRowIterator); - m_aDriverPoolingEnabled.Enable(bValidRow && m_aEnablePooling.IsChecked()); - m_aTimeoutLabel.Enable(bValidRow); - m_aTimeout.Enable(bValidRow); + m_pDriverPoolingEnabled->Enable(bValidRow && m_pEnablePooling->IsChecked()); + m_pTimeoutLabel->Enable(bValidRow); + m_pTimeout->Enable(bValidRow); if (!bValidRow) { // positioned on an invalid row - m_aDriver.SetText(String()); + m_pDriver->SetText(String()); } else { const DriverPooling *pDriverPos = static_cast<const DriverPooling*>(_pRowIterator); - m_aDriver.SetText(pDriverPos->sName); - m_aDriverPoolingEnabled.Check(pDriverPos->bEnabled); - m_aTimeout.SetText(OUString::number(pDriverPos->nTimeoutSeconds)); + m_pDriver->SetText(pDriverPos->sName); + m_pDriverPoolingEnabled->Check(pDriverPos->bEnabled); + m_pTimeout->SetText(OUString::number(pDriverPos->nTimeoutSeconds)); - OnEnabledDisabled(&m_aDriverPoolingEnabled); + OnEnabledDisabled(m_pDriverPoolingEnabled); } return 0L; @@ -453,7 +449,7 @@ namespace offapp { if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow()) { - pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_aTimeout.GetValue()); + pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_pTimeout->GetValue()); m_pDriverList->updateCurrentRow(); } } @@ -461,36 +457,33 @@ namespace offapp //-------------------------------------------------------------------- IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, const CheckBox*, _pCheckBox ) { - sal_Bool bGloballyEnabled = m_aEnablePooling.IsChecked(); - sal_Bool bLocalDriverChanged = &m_aDriverPoolingEnabled == _pCheckBox; + sal_Bool bGloballyEnabled = m_pEnablePooling->IsChecked(); + sal_Bool bLocalDriverChanged = m_pDriverPoolingEnabled == _pCheckBox; - if (&m_aEnablePooling == _pCheckBox) + if (m_pEnablePooling == _pCheckBox) { - m_aDriversLabel.Enable(bGloballyEnabled); + m_pDriversLabel->Enable(bGloballyEnabled); m_pDriverList->Enable(bGloballyEnabled); - m_aDriverLabel.Enable(bGloballyEnabled); - m_aDriver.Enable(bGloballyEnabled); - m_aDriverPoolingEnabled.Enable(bGloballyEnabled); + m_pDriverLabel->Enable(bGloballyEnabled); + m_pDriver->Enable(bGloballyEnabled); + m_pDriverPoolingEnabled->Enable(bGloballyEnabled); } else OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?"); - m_aTimeoutLabel.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked()); - m_aTimeout.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked()); + m_pTimeoutLabel->Enable(bGloballyEnabled && m_pDriverPoolingEnabled->IsChecked()); + m_pTimeout->Enable(bGloballyEnabled && m_pDriverPoolingEnabled->IsChecked()); if (bLocalDriverChanged) { // update the list - m_pDriverList->getCurrentRow()->bEnabled = m_aDriverPoolingEnabled.IsChecked(); + m_pDriverList->getCurrentRow()->bEnabled = m_pDriverPoolingEnabled->IsChecked(); m_pDriverList->updateCurrentRow(); } return 0L; } -//........................................................................ -} // namespace offapp -//........................................................................ - +} // namespace offapp /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.hrc b/cui/source/options/connpooloptions.hrc deleted file mode 100644 index 84a0a4d23cb8..000000000000 --- a/cui/source/options/connpooloptions.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_ -#define _OFFAPP_CONNPOOLOPTIONS_HRC_ - -#define FL_POOLING 1 -#define CB_POOL_CONNS 2 -#define FT_DRIVERS 3 -#define CTRL_DRIVER_LIST 4 -#define FT_DRIVERLABEL 5 -#define FT_DRIVER 6 -#define CB_DRIVERPOOLING 7 -#define FT_TIMEOUT 8 -#define NF_TIMEOUT 9 - -#define STR_DRIVER_NAME 1 -#define STR_POOLED_FLAG 2 -#define STR_POOL_TIMEOUT 3 -#define STR_YES 4 -#define STR_NO 5 - -#endif // _OFFAPP_CONNPOOLOPTIONS_HRC_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx index d2677a5e7c37..27e95bcafd75 100644 --- a/cui/source/options/connpooloptions.hxx +++ b/cui/source/options/connpooloptions.hxx @@ -27,11 +27,8 @@ #include <vcl/field.hxx> #include <svx/databaseregistrationui.hxx> -//........................................................................ namespace offapp { -//........................................................................ - //==================================================================== //= ConnectionPoolOptionsPage //==================================================================== @@ -41,15 +38,14 @@ namespace offapp using TabPage::ActivatePage; protected: - FixedLine m_aFrame; - CheckBox m_aEnablePooling; - FixedText m_aDriversLabel; + CheckBox* m_pEnablePooling; + FixedText* m_pDriversLabel; DriverListControl* m_pDriverList; - FixedText m_aDriverLabel; - FixedText m_aDriver; - CheckBox m_aDriverPoolingEnabled; - FixedText m_aTimeoutLabel; - NumericField m_aTimeout; + FixedText* m_pDriverLabel; + FixedText* m_pDriver; + CheckBox* m_pDriverPoolingEnabled; + FixedText* m_pTimeoutLabel; + NumericField* m_pTimeout; protected: ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet); @@ -57,12 +53,10 @@ namespace offapp public: static SfxTabPage* Create(Window* _pParent, const SfxItemSet& _rAttrSet); - ~ConnectionPoolOptionsPage(); - protected: virtual long Notify( NotifyEvent& _rNEvt ); - virtual sal_Bool FillItemSet(SfxItemSet& _rSet); + virtual sal_Bool FillItemSet(SfxItemSet& _rSet); virtual void Reset(const SfxItemSet& _rSet); virtual void ActivatePage( const SfxItemSet& _rSet); @@ -75,11 +69,8 @@ namespace offapp void commitTimeoutField(); }; -//........................................................................ -} // namespace offapp -//........................................................................ +} // namespace offapp #endif // _OFFAPP_CONNPOOLOPTIONS_HXX_ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.src b/cui/source/options/connpooloptions.src index f084fac11c85..5f441079f37f 100644 --- a/cui/source/options/connpooloptions.src +++ b/cui/source/options/connpooloptions.src @@ -17,111 +17,27 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "connpooloptions.hrc" #include <cuires.hrc> -#define PAGE_SIZE_X TP_WIDTH -#define PAGE_SIZE_Y TP_HEIGHT - -#define LIST_SIZE_Y 100 - -TabPage RID_OFAPAGE_CONNPOOLOPTIONS +String RID_SVXSTR_DRIVER_NAME { - HelpID = "cui:TabPage:RID_OFAPAGE_CONNPOOLOPTIONS"; - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ; - SVLook = TRUE ; - Hide = TRUE ; - - FixedLine FL_POOLING - { - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 8, 8 ); - Text [ en-US ] = "Connection pool"; - }; - CheckBox CB_POOL_CONNS - { - HelpID = "cui:CheckBox:RID_OFAPAGE_CONNPOOLOPTIONS:CB_POOL_CONNS"; - Pos = MAP_APPFONT( 7, 15 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14, 10 ); - Text [ en-US ] = "Connection pooling enabled"; - }; - FixedText FT_DRIVERS - { - Pos = MAP_APPFONT( 17, 28 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, 8 ); - Text [ en-US ] = "Drivers known in %PRODUCTNAME"; - }; - Control CTRL_DRIVER_LIST - { - Pos = MAP_APPFONT( 17, 39 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, LIST_SIZE_Y ); - TabStop = TRUE; - Border = TRUE; - SVLook = TRUE; - }; - FixedText FT_DRIVERLABEL - { - Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 ); - Size = MAP_APPFONT( 70, 8 ); - Text [ en-US ] = "Current driver:"; - }; - FixedText FT_DRIVER - { - Pos = MAP_APPFONT( 17 + 70 + 3, 39 + LIST_SIZE_Y + 4 ); - Size = MAP_APPFONT( PAGE_SIZE_X - ( 15 + 70 + 3 ) - 7, 8 ); - }; - CheckBox CB_DRIVERPOOLING - { - HelpID = "cui:CheckBox:RID_OFAPAGE_CONNPOOLOPTIONS:CB_DRIVERPOOLING"; - Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 + 8 + 3 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 23, 10 ); - Text [ en-US ] = "Enable pooling for this driver"; - }; - FixedText FT_TIMEOUT - { - Pos = MAP_APPFONT( 27, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 + 2 ); - Size = MAP_APPFONT( 100, 8 ); - Text [ en-US ] = "Timeout (seconds)"; - }; - NumericField NF_TIMEOUT - { - HelpID = "cui:NumericField:RID_OFAPAGE_CONNPOOLOPTIONS:NF_TIMEOUT"; - Pos = MAP_APPFONT( 27 + 100 + 3, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 ); - Size = MAP_APPFONT( 40, 12 ); - SvLook = TRUE; - Border = TRUE; - Right = TRUE; - Spin = TRUE; - Repeat = TRUE; - Minimum = 30; - Maximum = 600; - StrictFormat = TRUE; - DecimalDigits = 0; - SpinSize = 1; - }; - - String STR_DRIVER_NAME - { - Text [ en-US ] = "Driver name"; - }; - String STR_POOLED_FLAG - { - Text [ en-US ] = "Pool"; - }; - String STR_POOL_TIMEOUT - { - Text [ en-US ] = "Timeout"; - }; - String STR_YES - { - Text [ en-US ] = "Yes"; - }; - String STR_NO - { - Text [ en-US ] = "No"; - }; + Text [ en-US ] = "Driver name"; +}; +String RID_SVXSTR_POOLED_FLAG +{ + Text [ en-US ] = "Pool"; +}; +String RID_SVXSTR_POOL_TIMEOUT +{ + Text [ en-US ] = "Timeout"; +}; +String RID_SVXSTR_YES +{ + Text [ en-US ] = "Yes"; +}; +String RID_SVXSTR_NO +{ + Text [ en-US ] = "No"; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |