LCOV - code coverage report
Current view: top level - cui/source/options - connpooloptions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 195 0.0 %
Date: 2012-08-25 Functions: 0 37 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 277 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "connpooloptions.hxx"
      30                 :            : #include "connpooloptions.hrc"
      31                 :            : #include <svtools/editbrowsebox.hxx>
      32                 :            : #include <vcl/field.hxx>
      33                 :            : #include "connpoolsettings.hxx"
      34                 :            : #include <svl/eitem.hxx>
      35                 :            : #include <cuires.hrc>
      36                 :            : #include "helpid.hrc"
      37                 :            : #include <dialmgr.hxx>
      38                 :            : 
      39                 :            : //........................................................................
      40                 :            : namespace offapp
      41                 :            : {
      42                 :            : //........................................................................
      43                 :            : 
      44                 :            :     //====================================================================
      45                 :            :     //= DriverListControl
      46                 :            :     //====================================================================
      47                 :            :     typedef ::svt::EditBrowseBox DriverListControl_Base;
      48 [ #  # ][ #  # ]:          0 :     class DriverListControl : public DriverListControl_Base
                 [ #  # ]
      49                 :            :     {
      50                 :            :         using Window::Update;
      51                 :            :     protected:
      52                 :            :         DriverPoolingSettings                   m_aSavedSettings;
      53                 :            :         DriverPoolingSettings                   m_aSettings;
      54                 :            :         DriverPoolingSettings::const_iterator   m_aSeekRow;
      55                 :            : 
      56                 :            :         String                                  m_sYes;
      57                 :            :         String                                  m_sNo;
      58                 :            : 
      59                 :            :         Link                                    m_aRowChangeHandler;
      60                 :            : 
      61                 :            :     public:
      62                 :            :         DriverListControl( Window* _pParent, const ResId& _rId);
      63                 :            : 
      64                 :            :         virtual void Init();
      65                 :            :                 void Update(const DriverPoolingSettings& _rSettings);
      66                 :            :         virtual String GetCellText( long nRow, sal_uInt16 nColId ) const;
      67                 :            : 
      68                 :            :         // the handler will be called with a DriverPoolingSettings::const_iterator as parameter,
      69                 :            :         // or NULL if no valid current row exists
      70                 :          0 :         void SetRowChangeHandler(const Link& _rHdl) { m_aRowChangeHandler = _rHdl; }
      71                 :            :         Link GetRowChangeHandler() const { return m_aRowChangeHandler; }
      72                 :            : 
      73                 :            :         const DriverPooling* getCurrentRow() const;
      74                 :            :         DriverPooling* getCurrentRow();
      75                 :            :         void                                    updateCurrentRow();
      76                 :            : 
      77                 :          0 :         const DriverPoolingSettings& getSettings() const { return m_aSettings; }
      78                 :            : 
      79                 :          0 :         void        saveValue()             { m_aSavedSettings = m_aSettings; }
      80                 :            :         sal_Bool    isModified() const;
      81                 :            : 
      82                 :            :     protected:
      83                 :            :         virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol );
      84                 :            :         virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol );
      85                 :            : 
      86                 :            :         virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const;
      87                 :            : 
      88                 :            :         virtual sal_Bool SeekRow( long nRow );
      89                 :            :         virtual sal_Bool SaveModified();
      90                 :            : 
      91                 :            :         virtual sal_Bool IsTabAllowed(sal_Bool _bForward) const;
      92                 :            : 
      93                 :            :         virtual void StateChanged( StateChangedType nStateChange );
      94                 :            : 
      95                 :            :         virtual void CursorMoved();
      96                 :            : 
      97                 :            :     protected:
      98                 :            :         virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
      99                 :            : 
     100                 :            : 
     101                 :            :     private:
     102                 :            :         String implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const;
     103                 :            :     };
     104                 :            : 
     105                 :            :     //--------------------------------------------------------------------
     106                 :          0 :     DriverListControl::DriverListControl( Window* _pParent, const ResId& _rId)
     107                 :            :         :DriverListControl_Base(_pParent, _rId, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL)
     108                 :          0 :         ,m_aSeekRow(m_aSettings.end())
     109                 :          0 :         ,m_sYes(ResId(STR_YES,*_rId.GetResMgr()))
     110 [ #  # ][ #  # ]:          0 :         ,m_sNo(ResId(STR_NO,*_rId.GetResMgr()))
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     111                 :            :     {
     112 [ #  # ][ #  # ]:          0 :         SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL);
     113                 :            : 
     114         [ #  # ]:          0 :         SetUniqueId(UID_OFA_CONNPOOL_DRIVERLIST_BACK);
     115         [ #  # ]:          0 :         GetDataWindow().SetHelpId(HID_OFA_CONNPOOL_DRIVERLIST);
     116                 :          0 :     }
     117                 :            : 
     118                 :            :     //--------------------------------------------------------------------
     119                 :          0 :     sal_Bool DriverListControl::IsTabAllowed(sal_Bool /*_bForward*/) const
     120                 :            :     {
     121                 :            :         // no travinling within the fields via RETURN and TAB
     122                 :          0 :         return sal_False;
     123                 :            :     }
     124                 :            : 
     125                 :            :     //--------------------------------------------------------------------
     126                 :          0 :     sal_Bool DriverListControl::isModified() const
     127                 :            :     {
     128         [ #  # ]:          0 :         if (m_aSettings.size() != m_aSavedSettings.size())
     129                 :          0 :             return sal_True;
     130                 :            : 
     131                 :          0 :         DriverPoolingSettings::const_iterator aCurrent = m_aSettings.begin();
     132                 :          0 :         DriverPoolingSettings::const_iterator aCurrentEnd = m_aSettings.end();
     133                 :          0 :         DriverPoolingSettings::const_iterator aSaved = m_aSavedSettings.begin();
     134 [ #  # ][ #  # ]:          0 :         for (;aCurrent != aCurrentEnd; ++aCurrent, ++aSaved)
     135                 :            :         {
     136 [ #  # ][ #  # ]:          0 :             if (*aCurrent != *aSaved)
     137                 :          0 :                 return sal_True;
     138                 :            :         }
     139                 :            : 
     140                 :          0 :         return sal_False;
     141                 :            :     }
     142                 :            : 
     143                 :            :     //--------------------------------------------------------------------
     144                 :          0 :     void DriverListControl::Init()
     145                 :            :     {
     146         [ #  # ]:          0 :         DriverListControl_Base::Init();
     147                 :            : 
     148 [ #  # ][ #  # ]:          0 :         Size aColWidth = LogicToPixel(Size(160, 0), MAP_APPFONT);
                 [ #  # ]
     149 [ #  # ][ #  # ]:          0 :         InsertDataColumn(1, String(CUI_RES(STR_DRIVER_NAME)), aColWidth.Width());
         [ #  # ][ #  # ]
     150 [ #  # ][ #  # ]:          0 :         aColWidth = LogicToPixel(Size(30, 0), MAP_APPFONT);
                 [ #  # ]
     151 [ #  # ][ #  # ]:          0 :         InsertDataColumn(2, String(CUI_RES(STR_POOLED_FLAG)), aColWidth.Width());
         [ #  # ][ #  # ]
     152 [ #  # ][ #  # ]:          0 :         aColWidth = LogicToPixel(Size(60, 0), MAP_APPFONT);
                 [ #  # ]
     153 [ #  # ][ #  # ]:          0 :         InsertDataColumn(3, String(CUI_RES(STR_POOL_TIMEOUT)), aColWidth.Width());
         [ #  # ][ #  # ]
     154                 :            :             // Attention: the resource of the string is local to the resource of the enclosing dialog!
     155                 :          0 :     }
     156                 :            : 
     157                 :            :     //--------------------------------------------------------------------
     158                 :          0 :     void DriverListControl::CursorMoved()
     159                 :            :     {
     160                 :          0 :         DriverListControl_Base::CursorMoved();
     161                 :            : 
     162                 :            :         // call the row change handler
     163         [ #  # ]:          0 :         if ( m_aRowChangeHandler.IsSet() )
     164                 :            :         {
     165         [ #  # ]:          0 :             if ( GetCurRow() >= 0 )
     166                 :            :             {   // == -1 may happen in case the browse box has just been cleared
     167                 :          0 :                 m_aRowChangeHandler.Call( getCurrentRow() );
     168                 :            :             }
     169                 :            :         }
     170                 :          0 :     }
     171                 :            : 
     172                 :            :     //--------------------------------------------------------------------
     173                 :          0 :     const DriverPooling* DriverListControl::getCurrentRow() const
     174                 :            :     {
     175                 :            :         OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
     176                 :            :             "DriverListControl::getCurrentRow: invalid current row!");
     177                 :            : 
     178 [ #  # ][ #  # ]:          0 :         if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
                 [ #  # ]
     179         [ #  # ]:          0 :             return &(*(m_aSettings.begin() + GetCurRow()));
     180                 :            : 
     181                 :          0 :         return NULL;
     182                 :            :     }
     183                 :            : 
     184                 :            :     //--------------------------------------------------------------------
     185                 :          0 :     DriverPooling* DriverListControl::getCurrentRow()
     186                 :            :     {
     187                 :            :         OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
     188                 :            :             "DriverListControl::getCurrentRow: invalid current row!");
     189                 :            : 
     190 [ #  # ][ #  # ]:          0 :         if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
                 [ #  # ]
     191         [ #  # ]:          0 :             return &(*(m_aSettings.begin() + GetCurRow()));
     192                 :            : 
     193                 :          0 :         return NULL;
     194                 :            :     }
     195                 :            : 
     196                 :            :     //--------------------------------------------------------------------
     197                 :          0 :     void DriverListControl::updateCurrentRow()
     198                 :            :     {
     199         [ #  # ]:          0 :         Window::Invalidate( GetRowRectPixel( GetCurRow() ), INVALIDATE_UPDATE );
     200                 :          0 :     }
     201                 :            : 
     202                 :            :     //--------------------------------------------------------------------
     203                 :          0 :     void DriverListControl::Update(const DriverPoolingSettings& _rSettings)
     204                 :            :     {
     205                 :          0 :         m_aSettings = _rSettings;
     206                 :            : 
     207                 :          0 :         SetUpdateMode(sal_False);
     208                 :          0 :         RowRemoved(0, GetRowCount());
     209                 :          0 :         RowInserted(0, m_aSettings.size());
     210                 :          0 :         SetUpdateMode(sal_True);
     211                 :            : 
     212                 :          0 :         ActivateCell(1, 0);
     213                 :          0 :     }
     214                 :            : 
     215                 :            :     //--------------------------------------------------------------------
     216                 :          0 :     sal_uInt32 DriverListControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId)
     217                 :            :     {
     218         [ #  # ]:          0 :         return GetDataWindow().GetTextWidth(GetCellText(nRow, nColId));
     219                 :            :     }
     220                 :            : 
     221                 :            :     //--------------------------------------------------------------------
     222                 :          0 :     String DriverListControl::implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const
     223                 :            :     {
     224                 :            :         OSL_ENSURE(_rPos < m_aSettings.end(), "DriverListControl::implGetCellText: invalid position!");
     225                 :            : 
     226                 :          0 :         String sReturn;
     227   [ #  #  #  # ]:          0 :         switch (_nColId)
     228                 :            :         {
     229                 :            :             case 1:
     230         [ #  # ]:          0 :                 sReturn = _rPos->sName;
     231                 :          0 :                 break;
     232                 :            :             case 2:
     233 [ #  # ][ #  # ]:          0 :                 sReturn = _rPos->bEnabled ? m_sYes : m_sNo;
     234                 :          0 :                 break;
     235                 :            :             case 3:
     236         [ #  # ]:          0 :                 if (_rPos->bEnabled)
     237 [ #  # ][ #  # ]:          0 :                     sReturn = String::CreateFromInt32(_rPos->nTimeoutSeconds);
                 [ #  # ]
     238                 :          0 :                 break;
     239                 :            :             default:
     240                 :            :                 OSL_FAIL("DriverListControl::implGetCellText: invalid column id!");
     241                 :            :         }
     242                 :          0 :         return sReturn;
     243                 :            :     }
     244                 :            : 
     245                 :            :     //--------------------------------------------------------------------
     246                 :          0 :     void DriverListControl::StateChanged( StateChangedType nStateChange )
     247                 :            :     {
     248         [ #  # ]:          0 :         if (STATE_CHANGE_ENABLE == nStateChange)
     249                 :          0 :             Window::Invalidate(INVALIDATE_UPDATE);
     250                 :          0 :         DriverListControl_Base::StateChanged( nStateChange );
     251                 :          0 :     }
     252                 :            : 
     253                 :            :     //--------------------------------------------------------------------
     254                 :          0 :     String DriverListControl::GetCellText( long nRow, sal_uInt16 nColId ) const
     255                 :            :     {
     256                 :          0 :         String sReturn;
     257         [ #  # ]:          0 :         if (nRow > m_aSettings.size())
     258                 :            :         {
     259                 :            :             OSL_FAIL("DriverListControl::GetCellText: don't ask me for such rows!");
     260                 :            :         }
     261                 :            :         else
     262                 :            :         {
     263 [ #  # ][ #  # ]:          0 :             sReturn = implGetCellText(m_aSettings.begin() + nRow, nColId);
         [ #  # ][ #  # ]
     264                 :            :         }
     265                 :          0 :         return sReturn;
     266                 :            :     }
     267                 :            : 
     268                 :            :     //--------------------------------------------------------------------
     269                 :          0 :     void DriverListControl::InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol )
     270                 :            :     {
     271         [ #  # ]:          0 :         rController->GetWindow().SetText(GetCellText(nRow, nCol));
     272                 :          0 :     }
     273                 :            : 
     274                 :            :     //--------------------------------------------------------------------
     275                 :          0 :     ::svt::CellController* DriverListControl::GetController( long /*nRow*/, sal_uInt16 /*nCol*/ )
     276                 :            :     {
     277                 :          0 :         return NULL;
     278                 :            :     }
     279                 :            : 
     280                 :            :     //--------------------------------------------------------------------
     281                 :          0 :     sal_Bool DriverListControl::SaveModified()
     282                 :            :     {
     283                 :          0 :         return sal_True;
     284                 :            :     }
     285                 :            : 
     286                 :            :     //--------------------------------------------------------------------
     287                 :          0 :     sal_Bool DriverListControl::SeekRow( long _nRow )
     288                 :            :     {
     289                 :          0 :         DriverListControl_Base::SeekRow(_nRow);
     290                 :            : 
     291         [ #  # ]:          0 :         if (_nRow < m_aSettings.size())
     292 [ #  # ][ #  # ]:          0 :             m_aSeekRow = m_aSettings.begin() + _nRow;
     293                 :            :         else
     294         [ #  # ]:          0 :             m_aSeekRow = m_aSettings.end();
     295                 :            : 
     296         [ #  # ]:          0 :         return m_aSeekRow != m_aSettings.end();
     297                 :            :     }
     298                 :            : 
     299                 :            :     //--------------------------------------------------------------------
     300                 :          0 :     void DriverListControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const
     301                 :            :     {
     302                 :            :         OSL_ENSURE(m_aSeekRow != m_aSettings.end(), "DriverListControl::PaintCell: invalid row!");
     303                 :            : 
     304 [ #  # ][ #  # ]:          0 :         if (m_aSeekRow != m_aSettings.end())
     305                 :            :         {
     306         [ #  # ]:          0 :             rDev.SetClipRegion(rRect);
     307                 :            : 
     308                 :          0 :             sal_uInt16 nStyle = TEXT_DRAW_CLIP;
     309         [ #  # ]:          0 :             if (!IsEnabled())
     310                 :          0 :                 nStyle |= TEXT_DRAW_DISABLE;
     311      [ #  #  # ]:          0 :             switch (nColId)
     312                 :            :             {
     313                 :          0 :                 case 1: nStyle |= TEXT_DRAW_LEFT; break;
     314                 :            :                 case 2:
     315                 :          0 :                 case 3: nStyle |= TEXT_DRAW_CENTER; break;
     316                 :            :             }
     317                 :            : 
     318         [ #  # ]:          0 :             rDev.DrawText(rRect, implGetCellText(m_aSeekRow, nColId), nStyle);
     319                 :            : 
     320                 :          0 :             rDev.SetClipRegion();
     321                 :            :         }
     322                 :          0 :     }
     323                 :            : 
     324                 :            :     //====================================================================
     325                 :            :     //= ConnectionPoolOptionsPage
     326                 :            :     //====================================================================
     327                 :            :     //--------------------------------------------------------------------
     328                 :          0 :     ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet)
     329                 :          0 :         :SfxTabPage(_pParent, CUI_RES(RID_OFAPAGE_CONNPOOLOPTIONS ), _rAttrSet)
     330         [ #  # ]:          0 :         ,m_aFrame               (this,              CUI_RES(FL_POOLING))
     331         [ #  # ]:          0 :         ,m_aEnablePooling       (this,      CUI_RES(CB_POOL_CONNS))
     332         [ #  # ]:          0 :         ,m_aDriversLabel        (this,      CUI_RES(FT_DRIVERS))
     333 [ #  # ][ #  # ]:          0 :         ,m_pDriverList(new DriverListControl(this, CUI_RES(CTRL_DRIVER_LIST)))
     334         [ #  # ]:          0 :         ,m_aDriverLabel         (this,      CUI_RES(FT_DRIVERLABEL))
     335         [ #  # ]:          0 :         ,m_aDriver              (this,      CUI_RES(FT_DRIVER))
     336         [ #  # ]:          0 :         ,m_aDriverPoolingEnabled(this,      CUI_RES(CB_DRIVERPOOLING))
     337         [ #  # ]:          0 :         ,m_aTimeoutLabel        (this,      CUI_RES(FT_TIMEOUT))
     338 [ #  # ][ #  # ]:          0 :         ,m_aTimeout             (this,      CUI_RES(NF_TIMEOUT))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     339                 :            :     {
     340         [ #  # ]:          0 :         m_pDriverList->Init();
     341         [ #  # ]:          0 :         m_pDriverList->Show();
     342                 :            : 
     343         [ #  # ]:          0 :         FreeResource();
     344                 :            : 
     345         [ #  # ]:          0 :         m_aEnablePooling.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
     346         [ #  # ]:          0 :         m_aDriverPoolingEnabled.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
     347                 :            : 
     348         [ #  # ]:          0 :         m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) );
     349                 :          0 :     }
     350                 :            : 
     351                 :            :     //--------------------------------------------------------------------
     352                 :          0 :     SfxTabPage* ConnectionPoolOptionsPage::Create(Window* _pParent, const SfxItemSet& _rAttrSet)
     353                 :            :     {
     354         [ #  # ]:          0 :         return new ConnectionPoolOptionsPage(_pParent, _rAttrSet);
     355                 :            :     }
     356                 :            : 
     357                 :            :     //--------------------------------------------------------------------
     358 [ #  # ][ #  # ]:          0 :     ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     359                 :            :     {
     360 [ #  # ][ #  # ]:          0 :         delete m_pDriverList;
     361         [ #  # ]:          0 :     }
     362                 :            : 
     363                 :            :     //--------------------------------------------------------------------
     364                 :          0 :     void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bFromReset*/)
     365                 :            :     {
     366                 :            :         // the enabled flag
     367                 :          0 :         SFX_ITEMSET_GET( _rSet, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True );
     368                 :            :         OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
     369         [ #  # ]:          0 :         m_aEnablePooling.Check(pEnabled ? pEnabled->GetValue() : sal_True);
     370                 :            : 
     371                 :          0 :         m_aEnablePooling.SaveValue();
     372                 :            : 
     373                 :            :         // the settings for the single drivers
     374                 :          0 :         SFX_ITEMSET_GET( _rSet, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True );
     375         [ #  # ]:          0 :         if (pDriverSettings)
     376                 :          0 :             m_pDriverList->Update(pDriverSettings->getSettings());
     377                 :            :         else
     378                 :            :         {
     379                 :            :             OSL_FAIL("ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
     380         [ #  # ]:          0 :             m_pDriverList->Update(DriverPoolingSettings());
     381                 :            :         }
     382                 :          0 :         m_pDriverList->saveValue();
     383                 :            : 
     384                 :            :         // reflect the new settings
     385                 :          0 :         OnEnabledDisabled(&m_aEnablePooling);
     386                 :          0 :     }
     387                 :            : 
     388                 :            :     //--------------------------------------------------------------------
     389                 :          0 :     long ConnectionPoolOptionsPage::Notify( NotifyEvent& _rNEvt )
     390                 :            :     {
     391         [ #  # ]:          0 :         if (EVENT_LOSEFOCUS == _rNEvt.GetType())
     392         [ #  # ]:          0 :             if (m_aTimeout.IsWindowOrChild(_rNEvt.GetWindow()))
     393                 :          0 :                 commitTimeoutField();
     394                 :            : 
     395                 :          0 :         return SfxTabPage::Notify(_rNEvt);
     396                 :            :     }
     397                 :            : 
     398                 :            :     //--------------------------------------------------------------------
     399                 :          0 :     sal_Bool ConnectionPoolOptionsPage::FillItemSet(SfxItemSet& _rSet)
     400                 :            :     {
     401                 :          0 :         commitTimeoutField();
     402                 :            : 
     403                 :          0 :         sal_Bool bModified = sal_False;
     404                 :            :         // the enabled flag
     405         [ #  # ]:          0 :         if (m_aEnablePooling.GetSavedValue() != m_aEnablePooling.IsChecked())
     406                 :            :         {
     407         [ #  # ]:          0 :             _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_aEnablePooling.IsChecked()), SID_SB_POOLING_ENABLED);
     408                 :          0 :             bModified = sal_True;
     409                 :            :         }
     410                 :            : 
     411                 :            :         // the settings for the single drivers
     412         [ #  # ]:          0 :         if (m_pDriverList->isModified())
     413                 :            :         {
     414         [ #  # ]:          0 :             _rSet.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_pDriverList->getSettings()), SID_SB_DRIVER_TIMEOUTS);
     415                 :          0 :             bModified = sal_True;
     416                 :            :         }
     417                 :            : 
     418                 :          0 :         return bModified;
     419                 :            :     }
     420                 :            : 
     421                 :            :     //--------------------------------------------------------------------
     422                 :          0 :     void ConnectionPoolOptionsPage::ActivatePage( const SfxItemSet& _rSet)
     423                 :            :     {
     424                 :          0 :         SfxTabPage::ActivatePage(_rSet);
     425                 :          0 :         implInitControls(_rSet, sal_False);
     426                 :          0 :     }
     427                 :            : 
     428                 :            :     //--------------------------------------------------------------------
     429                 :          0 :     void ConnectionPoolOptionsPage::Reset(const SfxItemSet& _rSet)
     430                 :            :     {
     431                 :          0 :         implInitControls(_rSet, sal_True);
     432                 :          0 :     }
     433                 :            : 
     434                 :            :     //--------------------------------------------------------------------
     435                 :          0 :     IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const void*, _pRowIterator )
     436                 :            :     {
     437                 :          0 :         sal_Bool bValidRow = (NULL != _pRowIterator);
     438 [ #  # ][ #  # ]:          0 :         m_aDriverPoolingEnabled.Enable(bValidRow && m_aEnablePooling.IsChecked());
     439                 :          0 :         m_aTimeoutLabel.Enable(bValidRow);
     440                 :          0 :         m_aTimeout.Enable(bValidRow);
     441                 :            : 
     442         [ #  # ]:          0 :         if (!bValidRow)
     443                 :            :         {   // positioned on an invalid row
     444         [ #  # ]:          0 :             m_aDriver.SetText(String());
     445                 :            :         }
     446                 :            :         else
     447                 :            :         {
     448                 :          0 :             const DriverPooling *pDriverPos = static_cast<const DriverPooling*>(_pRowIterator);
     449                 :            : 
     450                 :          0 :             m_aDriver.SetText(pDriverPos->sName);
     451                 :          0 :             m_aDriverPoolingEnabled.Check(pDriverPos->bEnabled);
     452         [ #  # ]:          0 :             m_aTimeout.SetText(String::CreateFromInt32(pDriverPos->nTimeoutSeconds));
     453                 :            : 
     454                 :          0 :             OnEnabledDisabled(&m_aDriverPoolingEnabled);
     455                 :            :         }
     456                 :            : 
     457                 :          0 :         return 0L;
     458                 :            :     }
     459                 :            : 
     460                 :            :     //--------------------------------------------------------------------
     461                 :          0 :     void ConnectionPoolOptionsPage::commitTimeoutField()
     462                 :            :     {
     463         [ #  # ]:          0 :         if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow())
     464                 :            :         {
     465                 :          0 :             pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_aTimeout.GetValue());
     466                 :          0 :             m_pDriverList->updateCurrentRow();
     467                 :            :         }
     468                 :          0 :     }
     469                 :            : 
     470                 :            :     //--------------------------------------------------------------------
     471                 :          0 :     IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, const CheckBox*, _pCheckBox )
     472                 :            :     {
     473                 :          0 :         sal_Bool bGloballyEnabled = m_aEnablePooling.IsChecked();
     474                 :          0 :         sal_Bool bLocalDriverChanged = &m_aDriverPoolingEnabled == _pCheckBox;
     475                 :            : 
     476         [ #  # ]:          0 :         if (&m_aEnablePooling == _pCheckBox)
     477                 :            :         {
     478                 :          0 :             m_aDriversLabel.Enable(bGloballyEnabled);
     479                 :          0 :             m_pDriverList->Enable(bGloballyEnabled);
     480                 :          0 :             m_aDriverLabel.Enable(bGloballyEnabled);
     481                 :          0 :             m_aDriver.Enable(bGloballyEnabled);
     482                 :          0 :             m_aDriverPoolingEnabled.Enable(bGloballyEnabled);
     483                 :            :         }
     484                 :            :         else
     485                 :            :             OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
     486                 :            : 
     487 [ #  # ][ #  # ]:          0 :         m_aTimeoutLabel.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
     488 [ #  # ][ #  # ]:          0 :         m_aTimeout.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
     489                 :            : 
     490         [ #  # ]:          0 :         if (bLocalDriverChanged)
     491                 :            :         {
     492                 :            :             // update the list
     493                 :          0 :             m_pDriverList->getCurrentRow()->bEnabled = m_aDriverPoolingEnabled.IsChecked();
     494                 :          0 :             m_pDriverList->updateCurrentRow();
     495                 :            :         }
     496                 :            : 
     497                 :          0 :         return 0L;
     498                 :            :     }
     499                 :            : 
     500                 :            : //........................................................................
     501                 :            : }   // namespace offapp
     502                 :            : //........................................................................
     503                 :            : 
     504                 :            : 
     505                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10