LCOV - code coverage report
Current view: top level - svtools/source/dialogs - PlaceEditDialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 141 0.0 %
Date: 2012-08-25 Functions: 0 17 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 566 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4                 :            :  *
       5                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       8                 :            :  * the License at http://www.mozilla.org/MPL/
       9                 :            :  *
      10                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :            :  * for the specific language governing rights and limitations under the
      13                 :            :  * License.
      14                 :            :  *
      15                 :            :  * Major Contributor(s):
      16                 :            :  * [ Copyright (C) 2012 Julien Levesy <jlevesy@gmail.com> (initial developer) ]
      17                 :            :  *
      18                 :            :  * All Rights Reserved.
      19                 :            :  *
      20                 :            :  * For minor contributions see the git repository.
      21                 :            :  *
      22                 :            :  * Alternatively, the contents of this file may be used under the terms of
      23                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26                 :            :  * instead of those above.
      27                 :            :  */
      28                 :            : 
      29                 :            : #include "PlaceEditDialog.hrc"
      30                 :            : #include "PlaceEditDialog.hxx"
      31                 :            : #include "ServerDetailsControls.hxx"
      32                 :            : 
      33                 :            : #include <officecfg/Office/Common.hxx>
      34                 :            : #include <svtools/svtresid.hxx>
      35                 :            : #include <vcl/msgbox.hxx>
      36                 :            : 
      37                 :            : using namespace boost;
      38                 :            : 
      39                 :          0 : PlaceEditDialog::PlaceEditDialog(       Window* pParent ) :
      40                 :            :     ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ),
      41                 :            :     m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ),
      42                 :            :     m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ),
      43                 :            :     m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ),
      44                 :            :     m_aLBServerType ( this, SvtResId( LB_ADDPLACE_SERVERTYPE ) ),
      45                 :            :     m_pCurrentDetails( ),
      46                 :            :     m_aFTHost( this, SvtResId( FT_ADDPLACE_HOST ) ),
      47                 :            :     m_aEDHost( this, SvtResId( ED_ADDPLACE_HOST ) ),
      48                 :            :     m_aFTPort( this, SvtResId( FT_ADDPLACE_PORT ) ),
      49                 :            :     m_aEDPort( this, SvtResId( ED_ADDPLACE_PORT ) ),
      50                 :            :     m_aFTPath( this, SvtResId( FT_ADDPLACE_PATH ) ),
      51                 :            :     m_aEDPath( this, SvtResId( ED_ADDPLACE_PATH ) ),
      52                 :            :     m_aCBDavs( this, SvtResId( CB_ADDPLACE_DAVS ) ),
      53                 :            :     m_aEDSmbHost( this, SvtResId( ED_ADDPLACE_SMBHOST ) ),
      54                 :            :     m_aFTShare( this, SvtResId( FT_ADDPLACE_SHARE ) ),
      55                 :            :     m_aEDShare( this, SvtResId( ED_ADDPLACE_SHARE ) ),
      56                 :            :     m_aFTSmbPath( this, SvtResId( FT_ADDPLACE_SMBPATH ) ),
      57                 :            :     m_aEDSmbPath( this, SvtResId( ED_ADDPLACE_SMBPATH ) ),
      58                 :            :     m_aFTCmisBinding( this, SvtResId( FT_ADDPLACE_CMIS_BINDING ) ),
      59                 :            :     m_aEDCmisBinding( this, SvtResId( ED_ADDPLACE_CMIS_BINDING ) ),
      60                 :            :     m_aFTCmisRepository( this, SvtResId( FT_ADDPLACE_CMIS_REPOSITORY ) ),
      61                 :            :     m_aLBCmisRepository( this, SvtResId( LB_ADDPLACE_CMIS_REPOSITORY ) ),
      62                 :            :     m_aBTCmisRepoRefresh( this, SvtResId( BT_ADDPLACE_CMIS_REPOREFRESH ) ),
      63                 :            :     m_aFTUsername( this, SvtResId( FT_ADDPLACE_USERNAME ) ),
      64                 :            :     m_aEDUsername( this, SvtResId( ED_ADDPLACE_USERNAME ) ),
      65                 :            :     m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ),
      66                 :            :     m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ),
      67 [ #  # ][ #  # ]:          0 :     m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      68                 :            : {
      69         [ #  # ]:          0 :     m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
      70         [ #  # ]:          0 :     m_aBTOk.Enable( sal_False );
      71                 :            : 
      72         [ #  # ]:          0 :     m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
      73                 :            : 
      74                 :            :     // This constructor is called when user request a place creation, so
      75                 :            :     // delete button is hidden.
      76         [ #  # ]:          0 :     m_aBTDelete.Hide();
      77                 :            : 
      78         [ #  # ]:          0 :     m_aLBServerType.SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) );
      79         [ #  # ]:          0 :     m_aEDUsername.SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) );
      80                 :            : 
      81         [ #  # ]:          0 :     InitDetails( );
      82                 :          0 : }
      83                 :            : 
      84                 :          0 : PlaceEditDialog::PlaceEditDialog( Window* pParent, const boost::shared_ptr<Place>& pPlace ) :
      85                 :            :     ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ),
      86                 :            :     m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ),
      87                 :            :     m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ),
      88                 :            :     m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ),
      89                 :            :     m_aLBServerType ( this, SvtResId( LB_ADDPLACE_SERVERTYPE ) ),
      90                 :            :     m_pCurrentDetails( ),
      91                 :            :     m_aFTHost( this, SvtResId( FT_ADDPLACE_HOST ) ),
      92                 :            :     m_aEDHost( this, SvtResId( ED_ADDPLACE_HOST ) ),
      93                 :            :     m_aFTPort( this, SvtResId( FT_ADDPLACE_PORT ) ),
      94                 :            :     m_aEDPort( this, SvtResId( ED_ADDPLACE_PORT ) ),
      95                 :            :     m_aFTPath( this, SvtResId( FT_ADDPLACE_PATH ) ),
      96                 :            :     m_aEDPath( this, SvtResId( ED_ADDPLACE_PATH ) ),
      97                 :            :     m_aCBDavs( this, SvtResId( CB_ADDPLACE_DAVS ) ),
      98                 :            :     m_aEDSmbHost( this, SvtResId( ED_ADDPLACE_SMBHOST ) ),
      99                 :            :     m_aFTShare( this, SvtResId( FT_ADDPLACE_SHARE ) ),
     100                 :            :     m_aEDShare( this, SvtResId( ED_ADDPLACE_SHARE ) ),
     101                 :            :     m_aFTSmbPath( this, SvtResId( FT_ADDPLACE_SMBPATH ) ),
     102                 :            :     m_aEDSmbPath( this, SvtResId( ED_ADDPLACE_SMBPATH ) ),
     103                 :            :     m_aFTCmisBinding( this, SvtResId( FT_ADDPLACE_CMIS_BINDING ) ),
     104                 :            :     m_aEDCmisBinding( this, SvtResId( ED_ADDPLACE_CMIS_BINDING ) ),
     105                 :            :     m_aFTCmisRepository( this, SvtResId( FT_ADDPLACE_CMIS_REPOSITORY ) ),
     106                 :            :     m_aLBCmisRepository( this, SvtResId( LB_ADDPLACE_CMIS_REPOSITORY ) ),
     107                 :            :     m_aBTCmisRepoRefresh( this, SvtResId( BT_ADDPLACE_CMIS_REPOREFRESH ) ),
     108                 :            :     m_aFTUsername( this, SvtResId( FT_ADDPLACE_USERNAME ) ),
     109                 :            :     m_aEDUsername( this, SvtResId( ED_ADDPLACE_USERNAME ) ),
     110                 :            :     m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ),
     111                 :            :     m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ),
     112 [ #  # ][ #  # ]:          0 :     m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     113                 :            : {
     114         [ #  # ]:          0 :     m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
     115         [ #  # ]:          0 :     m_aBTDelete.SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) );
     116                 :            : 
     117         [ #  # ]:          0 :     m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
     118         [ #  # ]:          0 :     m_aLBServerType.SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) );
     119                 :            : 
     120         [ #  # ]:          0 :     InitDetails( );
     121                 :            : 
     122 [ #  # ][ #  # ]:          0 :     m_aEDServerName.SetText( pPlace->GetName() );
                 [ #  # ]
     123                 :            : 
     124                 :            :     // Fill the boxes with the URL parts
     125                 :          0 :     bool bSuccess = false;
     126 [ #  # ][ #  # ]:          0 :     for ( size_t i = 0 ; i < m_aDetailsContainers.size( ) && !bSuccess; ++i )
                 [ #  # ]
     127                 :            :     {
     128                 :          0 :         INetURLObject& rUrl = pPlace->GetUrlObject( );
     129         [ #  # ]:          0 :         bSuccess = m_aDetailsContainers[i]->setUrl( rUrl );
     130         [ #  # ]:          0 :         if ( bSuccess )
     131                 :            :         {
     132         [ #  # ]:          0 :             m_aLBServerType.SelectEntryPos( i );
     133         [ #  # ]:          0 :             SelectTypeHdl( &m_aLBServerType );
     134                 :            : 
     135                 :            :             // Fill the Username field
     136 [ #  # ][ #  # ]:          0 :             if ( rUrl.HasUserData( ) )
     137 [ #  # ][ #  # ]:          0 :                 m_aEDUsername.SetText( rUrl.GetUser( ) );
         [ #  # ][ #  # ]
     138                 :            :         }
     139                 :            :     }
     140                 :          0 : }
     141                 :            : 
     142 [ #  # ][ #  # ]:          0 : PlaceEditDialog::~PlaceEditDialog()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     143                 :            : {
     144         [ #  # ]:          0 : }
     145                 :            : 
     146                 :          0 : rtl::OUString PlaceEditDialog::GetServerUrl()
     147                 :            : {
     148                 :          0 :     rtl::OUString sUrl;
     149         [ #  # ]:          0 :     if ( m_pCurrentDetails.get( ) )
     150                 :            :     {
     151         [ #  # ]:          0 :         INetURLObject aUrl = m_pCurrentDetails->getUrl();
     152 [ #  # ][ #  # ]:          0 :         rtl::OUString sUsername = rtl::OUString( m_aEDUsername.GetText( ) ).trim( );
                 [ #  # ]
     153         [ #  # ]:          0 :         if ( !sUsername.isEmpty( ) )
     154         [ #  # ]:          0 :             aUrl.SetUser( sUsername );
     155         [ #  # ]:          0 :         if ( !aUrl.HasError( ) )
     156 [ #  # ][ #  # ]:          0 :             sUrl = aUrl.GetMainURL( INetURLObject::NO_DECODE );
     157                 :            :     }
     158                 :            : 
     159                 :          0 :     return sUrl;
     160                 :            : }
     161                 :            : 
     162                 :          0 : boost::shared_ptr<Place> PlaceEditDialog::GetPlace()
     163                 :            : {
     164 [ #  # ][ #  # ]:          0 :     boost::shared_ptr<Place> newPlace( new Place( m_aEDServerName.GetText(), GetServerUrl(), true ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     165                 :          0 :     return newPlace;
     166                 :            : }
     167                 :            : 
     168                 :          0 : void PlaceEditDialog::InitDetails( )
     169                 :            : {
     170                 :            :     // Create WebDAV / FTP / SSH details control
     171 [ #  # ][ #  # ]:          0 :     shared_ptr< DetailsContainer > pDavDetails( new DavDetailsContainer( ) );
                 [ #  # ]
     172         [ #  # ]:          0 :     pDavDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost );
     173         [ #  # ]:          0 :     pDavDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost );
     174         [ #  # ]:          0 :     pDavDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort );
     175         [ #  # ]:          0 :     pDavDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort );
     176         [ #  # ]:          0 :     pDavDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath );
     177         [ #  # ]:          0 :     pDavDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath );
     178         [ #  # ]:          0 :     pDavDetails->addControl( CB_ADDPLACE_DAVS, &m_aCBDavs );
     179         [ #  # ]:          0 :     pDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     180         [ #  # ]:          0 :     m_aDetailsContainers.push_back( pDavDetails );
     181                 :            : 
     182 [ #  # ][ #  # ]:          0 :     shared_ptr< DetailsContainer > pFtpDetails( new HostDetailsContainer( 21, "ftp" ) );
                 [ #  # ]
     183         [ #  # ]:          0 :     pFtpDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost );
     184         [ #  # ]:          0 :     pFtpDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost );
     185         [ #  # ]:          0 :     pFtpDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort );
     186         [ #  # ]:          0 :     pFtpDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort );
     187         [ #  # ]:          0 :     pFtpDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath );
     188         [ #  # ]:          0 :     pFtpDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath );
     189         [ #  # ]:          0 :     pFtpDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     190         [ #  # ]:          0 :     m_aDetailsContainers.push_back( pFtpDetails );
     191                 :            : 
     192 [ #  # ][ #  # ]:          0 :     shared_ptr< DetailsContainer > pSshDetails( new HostDetailsContainer( 22, "ssh" ) );
                 [ #  # ]
     193         [ #  # ]:          0 :     pSshDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost );
     194         [ #  # ]:          0 :     pSshDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost );
     195         [ #  # ]:          0 :     pSshDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort );
     196         [ #  # ]:          0 :     pSshDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort );
     197         [ #  # ]:          0 :     pSshDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath );
     198         [ #  # ]:          0 :     pSshDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath );
     199         [ #  # ]:          0 :     pSshDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     200         [ #  # ]:          0 :     m_aDetailsContainers.push_back( pSshDetails );
     201                 :            : 
     202                 :            :     // Create Windows Share control
     203 [ #  # ][ #  # ]:          0 :     shared_ptr< DetailsContainer > pSmbDetails( new SmbDetailsContainer( ) );
                 [ #  # ]
     204         [ #  # ]:          0 :     pSmbDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost );
     205         [ #  # ]:          0 :     pSmbDetails->addControl( ED_ADDPLACE_SMBHOST, &m_aEDSmbHost );
     206         [ #  # ]:          0 :     pSmbDetails->addControl( FT_ADDPLACE_SHARE, &m_aFTShare );
     207         [ #  # ]:          0 :     pSmbDetails->addControl( ED_ADDPLACE_SHARE, &m_aEDShare );
     208         [ #  # ]:          0 :     pSmbDetails->addControl( FT_ADDPLACE_SMBPATH, &m_aFTSmbPath );
     209         [ #  # ]:          0 :     pSmbDetails->addControl( ED_ADDPLACE_SMBPATH, &m_aEDSmbPath );
     210         [ #  # ]:          0 :     pSmbDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     211         [ #  # ]:          0 :     m_aDetailsContainers.push_back( pSmbDetails );
     212                 :            : 
     213                 :            :     // Create CMIS control
     214 [ #  # ][ #  # ]:          0 :     shared_ptr< DetailsContainer > pCmisDetails( new CmisDetailsContainer( ) );
                 [ #  # ]
     215         [ #  # ]:          0 :     pCmisDetails->addControl( FT_ADDPLACE_CMIS_BINDING, &m_aFTCmisBinding );
     216         [ #  # ]:          0 :     pCmisDetails->addControl( ED_ADDPLACE_CMIS_BINDING, &m_aEDCmisBinding );
     217         [ #  # ]:          0 :     pCmisDetails->addControl( FT_ADDPLACE_CMIS_REPOSITORY, &m_aFTCmisRepository );
     218         [ #  # ]:          0 :     pCmisDetails->addControl( LB_ADDPLACE_CMIS_REPOSITORY, &m_aLBCmisRepository );
     219         [ #  # ]:          0 :     pCmisDetails->addControl( BT_ADDPLACE_CMIS_REPOREFRESH, &m_aBTCmisRepoRefresh );
     220         [ #  # ]:          0 :     pCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     221                 :            : 
     222   [ #  #  #  # ]:          0 :     if ( officecfg::Office::Common::Misc::ExperimentalMode::get() )
     223         [ #  # ]:          0 :         m_aDetailsContainers.push_back( pCmisDetails );
     224                 :            :     else
     225                 :            :     {
     226                 :            :         // Remove the CMIS entry, left it in src file for l10n
     227 [ #  # ][ #  # ]:          0 :         m_aLBServerType.RemoveEntry( m_aLBServerType.GetEntryCount( ) - 1 );
     228                 :            :     }
     229                 :            : 
     230                 :            :     // Set default to first value
     231         [ #  # ]:          0 :     m_aLBServerType.SelectEntryPos( 0 );
     232 [ #  # ][ #  # ]:          0 :     SelectTypeHdl( &m_aLBServerType );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     233                 :          0 : }
     234                 :            : 
     235                 :          0 : IMPL_LINK ( PlaceEditDialog,  OKHdl, Button *, EMPTYARG )
     236                 :            : {
     237                 :          0 :     EndDialog( RET_OK );
     238                 :          0 :     return 1;
     239                 :            : }
     240                 :            : 
     241                 :          0 : IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, EMPTYARG )
     242                 :            : {
     243                 :            :     // ReUsing existing symbols...
     244                 :          0 :     EndDialog( RET_NO );
     245                 :          0 :     return 1;
     246                 :            : }
     247                 :            : 
     248                 :          0 : IMPL_LINK ( PlaceEditDialog, EditHdl, void *, EMPTYARG )
     249                 :            : {
     250         [ #  # ]:          0 :     rtl::OUString sUrl = GetServerUrl( );
     251 [ #  # ][ #  # ]:          0 :     rtl::OUString sName = rtl::OUString( m_aEDServerName.GetText() ).trim( );
                 [ #  # ]
     252 [ #  # ][ #  # ]:          0 :     m_aBTOk.Enable( !sName.isEmpty( ) && !sUrl.isEmpty( ) );
                 [ #  # ]
     253                 :          0 :     return 1;
     254                 :            : }
     255                 :            : 
     256                 :          0 : IMPL_LINK ( PlaceEditDialog, EditUsernameHdl, void *, EMPTYARG )
     257                 :            : {
     258 [ #  # ][ #  # ]:          0 :     for ( std::vector< boost::shared_ptr< DetailsContainer > >::iterator it = m_aDetailsContainers.begin( );
     259                 :          0 :             it != m_aDetailsContainers.end( ); ++it )
     260                 :            :     {
     261 [ #  # ][ #  # ]:          0 :         ( *it )->setUsername( rtl::OUString( m_aEDUsername.GetText() ) );
         [ #  # ][ #  # ]
     262                 :            :     }
     263                 :          0 :     return 1;
     264                 :            : }
     265                 :            : 
     266                 :          0 : IMPL_LINK( PlaceEditDialog, SelectTypeHdl, void*, EMPTYARG )
     267                 :            : {
     268                 :            :     // Compute the vertical space between two rows
     269 [ #  # ][ #  # ]:          0 :     long nRowDelta = m_aLBServerType.GetPosPixel().getY() - m_aEDServerName.GetPosPixel().getY();
     270         [ #  # ]:          0 :     long nRowSpace = nRowDelta - m_aEDServerName.GetSizePixel().getHeight();
     271                 :            : 
     272                 :          0 :     long nOldHeight = 0;
     273         [ #  # ]:          0 :     if ( m_pCurrentDetails.get( ) )
     274                 :            :     {
     275         [ #  # ]:          0 :         m_pCurrentDetails->show( false );
     276         [ #  # ]:          0 :         Rectangle aOldBounds = m_pCurrentDetails->getBounds( );
     277 [ #  # ][ #  # ]:          0 :         if ( !aOldBounds.IsEmpty() )
     278                 :          0 :             nOldHeight = aOldBounds.getHeight();
     279                 :            :     }
     280                 :            : 
     281         [ #  # ]:          0 :     sal_uInt16 nPos = m_aLBServerType.GetSelectEntryPos( );
     282         [ #  # ]:          0 :     m_pCurrentDetails = m_aDetailsContainers[nPos];
     283                 :            : 
     284         [ #  # ]:          0 :     m_pCurrentDetails->show( true );
     285         [ #  # ]:          0 :     Rectangle aNewBounds = m_pCurrentDetails->getBounds();
     286                 :            : 
     287                 :          0 :     long nNewHeight = 0;
     288 [ #  # ][ #  # ]:          0 :     if ( !aNewBounds.IsEmpty() )
     289                 :            :     {
     290                 :          0 :         nNewHeight = aNewBounds.getHeight();
     291                 :            : 
     292                 :            :         // Add row space if old height was 0
     293         [ #  # ]:          0 :         if ( nOldHeight == 0 )
     294                 :          0 :             nNewHeight += nRowSpace;
     295                 :            :     }
     296                 :            : 
     297                 :            :     // If the new height is 0, but not the old one, then remove the doubled row space
     298 [ #  # ][ #  # ]:          0 :     if ( nNewHeight == 0 && nOldHeight > 0 )
     299                 :          0 :         nNewHeight -= nRowSpace;
     300                 :            : 
     301                 :          0 :     long nHeightDelta = nNewHeight - nOldHeight;
     302                 :            :     Control* pToMove[] =
     303                 :            :     {
     304                 :            :         &m_aFTUsername,
     305                 :            :         &m_aEDUsername,
     306                 :            :         &m_aBTOk,
     307                 :            :         &m_aBTCancel,
     308                 :            :         &m_aBTDelete
     309                 :          0 :     };
     310                 :            : 
     311                 :          0 :     Control** pCurrent = pToMove;
     312         [ #  # ]:          0 :     for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pToMove )); ++i, ++pCurrent )
     313                 :            :     {
     314         [ #  # ]:          0 :         Point aPos = ( *pCurrent )->GetPosPixel( );
     315                 :          0 :         aPos.setY( aPos.getY( ) + nHeightDelta );
     316         [ #  # ]:          0 :         ( *pCurrent )->SetPosPixel( aPos );
     317                 :            :     }
     318                 :            : 
     319                 :            :     // Resize the dialog too
     320         [ #  # ]:          0 :     Size aDlgSize = GetSizePixel( );
     321                 :          0 :     aDlgSize.setHeight( aDlgSize.getHeight( ) + nHeightDelta );
     322         [ #  # ]:          0 :     SetSizePixel( aDlgSize );
     323                 :            : 
     324                 :            : 
     325                 :          0 :     return 0;
     326                 :            : }
     327                 :            : 
     328                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10