LCOV - code coverage report
Current view: top level - extensions/source/abpilot - fieldmappingpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 37 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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 "fieldmappingpage.hxx"
      30                 :            : #include "fieldmappingimpl.hxx"
      31                 :            : #include "addresssettings.hxx"
      32                 :            : #include "abspilot.hxx"
      33                 :            : 
      34                 :            : //.........................................................................
      35                 :            : namespace abp
      36                 :            : {
      37                 :            : //.........................................................................
      38                 :            : 
      39                 :            :     //=====================================================================
      40                 :            :     //= FieldMappingPage
      41                 :            :     //=====================================================================
      42                 :            :     //---------------------------------------------------------------------
      43                 :          0 :     FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent )
      44                 :            :         :AddressBookSourcePage( _pParent, ModuleRes( RID_PAGE_FIELDMAPPING ) )
      45                 :            :         ,m_aExplanation     ( this, ModuleRes( FT_FIELDASSIGMENTEXPL ) )
      46                 :            :         ,m_aInvokeDialog    ( this, ModuleRes( PB_INVOKE_FIELDS_DIALOG ) )
      47                 :          0 :         ,m_aHint            ( this, ModuleRes( FT_ASSIGNEDFIELDS ) )
      48                 :            :     {
      49                 :          0 :         FreeResource();
      50                 :            : 
      51                 :          0 :         m_aInvokeDialog.SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) );
      52                 :            : 
      53                 :            :         // check the size of the InvokeDialog button - some languages are very ... gossipy here ....
      54                 :          0 :         sal_Int32 nTextWidth = m_aInvokeDialog.GetTextWidth( m_aInvokeDialog.GetText() );
      55                 :            : 
      56                 :          0 :         sal_Int32 nBorderSpace = m_aInvokeDialog.LogicToPixel( Point( 4, 0 ), MAP_APPFONT ).X();
      57                 :          0 :         sal_Int32 nSpace = m_aInvokeDialog.GetOutputSizePixel().Width() - 2 * nBorderSpace;
      58                 :            : 
      59                 :          0 :         if ( nSpace < nTextWidth )
      60                 :            :         {
      61                 :          0 :             Size aButtonSize = m_aInvokeDialog.GetSizePixel();
      62                 :          0 :             aButtonSize.Width() += nTextWidth - nSpace;
      63                 :          0 :             m_aInvokeDialog.SetSizePixel( aButtonSize );
      64                 :            :         }
      65                 :          0 :     }
      66                 :            : 
      67                 :            :     //---------------------------------------------------------------------
      68                 :          0 :     void FieldMappingPage::ActivatePage()
      69                 :            :     {
      70                 :          0 :         AddressBookSourcePage::ActivatePage();
      71                 :          0 :         m_aInvokeDialog.GrabFocus();
      72                 :          0 :     }
      73                 :            : 
      74                 :            :     //---------------------------------------------------------------------
      75                 :          0 :     void FieldMappingPage::DeactivatePage()
      76                 :            :     {
      77                 :          0 :         AddressBookSourcePage::DeactivatePage();
      78                 :          0 :     }
      79                 :            : 
      80                 :            :     //---------------------------------------------------------------------
      81                 :          0 :     void FieldMappingPage::initializePage()
      82                 :            :     {
      83                 :          0 :         AddressBookSourcePage::initializePage();
      84                 :          0 :         implUpdateHint();
      85                 :          0 :     }
      86                 :            : 
      87                 :            :     //---------------------------------------------------------------------
      88                 :          0 :     void FieldMappingPage::implUpdateHint()
      89                 :            :     {
      90                 :          0 :         const AddressSettings& rSettings = getSettings();
      91                 :          0 :         String sHint;
      92                 :          0 :         if ( 0 == rSettings.aFieldMapping.size() )
      93                 :          0 :             sHint = String( ModuleRes( RID_STR_NOFIELDSASSIGNED ) );
      94                 :          0 :         m_aHint.SetText( sHint );
      95                 :          0 :     }
      96                 :            : 
      97                 :            :     //---------------------------------------------------------------------
      98                 :          0 :     IMPL_LINK( FieldMappingPage, OnInvokeDialog, void*, /*NOTINTERESTEDIN*/ )
      99                 :            :     {
     100                 :          0 :         AddressSettings& rSettings = getSettings();
     101                 :            : 
     102                 :            :         // invoke the dialog doing the mapping
     103                 :          0 :         if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) )
     104                 :            :         {
     105                 :          0 :             if ( rSettings.aFieldMapping.size() )
     106                 :          0 :                 getDialog()->travelNext();
     107                 :            :             else
     108                 :          0 :                 implUpdateHint();
     109                 :            :         }
     110                 :            : 
     111                 :          0 :         return 0L;
     112                 :            :     }
     113                 :            : 
     114                 :            : //.........................................................................
     115                 :            : }   // namespace abp
     116                 :            : //.........................................................................
     117                 :            : 
     118                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10