LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/abpilot - fieldmappingpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 37 0.0 %
Date: 2012-12-27 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "fieldmappingpage.hxx"
      21             : #include "fieldmappingimpl.hxx"
      22             : #include "addresssettings.hxx"
      23             : #include "abspilot.hxx"
      24             : 
      25             : //.........................................................................
      26             : namespace abp
      27             : {
      28             : //.........................................................................
      29             : 
      30             :     //=====================================================================
      31             :     //= FieldMappingPage
      32             :     //=====================================================================
      33             :     //---------------------------------------------------------------------
      34           0 :     FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent )
      35             :         :AddressBookSourcePage( _pParent, ModuleRes( RID_PAGE_FIELDMAPPING ) )
      36             :         ,m_aExplanation     ( this, ModuleRes( FT_FIELDASSIGMENTEXPL ) )
      37             :         ,m_aInvokeDialog    ( this, ModuleRes( PB_INVOKE_FIELDS_DIALOG ) )
      38           0 :         ,m_aHint            ( this, ModuleRes( FT_ASSIGNEDFIELDS ) )
      39             :     {
      40           0 :         FreeResource();
      41             : 
      42           0 :         m_aInvokeDialog.SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) );
      43             : 
      44             :         // check the size of the InvokeDialog button - some languages are very ... gossipy here ....
      45           0 :         sal_Int32 nTextWidth = m_aInvokeDialog.GetTextWidth( m_aInvokeDialog.GetText() );
      46             : 
      47           0 :         sal_Int32 nBorderSpace = m_aInvokeDialog.LogicToPixel( Point( 4, 0 ), MAP_APPFONT ).X();
      48           0 :         sal_Int32 nSpace = m_aInvokeDialog.GetOutputSizePixel().Width() - 2 * nBorderSpace;
      49             : 
      50           0 :         if ( nSpace < nTextWidth )
      51             :         {
      52           0 :             Size aButtonSize = m_aInvokeDialog.GetSizePixel();
      53           0 :             aButtonSize.Width() += nTextWidth - nSpace;
      54           0 :             m_aInvokeDialog.SetSizePixel( aButtonSize );
      55             :         }
      56           0 :     }
      57             : 
      58             :     //---------------------------------------------------------------------
      59           0 :     void FieldMappingPage::ActivatePage()
      60             :     {
      61           0 :         AddressBookSourcePage::ActivatePage();
      62           0 :         m_aInvokeDialog.GrabFocus();
      63           0 :     }
      64             : 
      65             :     //---------------------------------------------------------------------
      66           0 :     void FieldMappingPage::DeactivatePage()
      67             :     {
      68           0 :         AddressBookSourcePage::DeactivatePage();
      69           0 :     }
      70             : 
      71             :     //---------------------------------------------------------------------
      72           0 :     void FieldMappingPage::initializePage()
      73             :     {
      74           0 :         AddressBookSourcePage::initializePage();
      75           0 :         implUpdateHint();
      76           0 :     }
      77             : 
      78             :     //---------------------------------------------------------------------
      79           0 :     void FieldMappingPage::implUpdateHint()
      80             :     {
      81           0 :         const AddressSettings& rSettings = getSettings();
      82           0 :         String sHint;
      83           0 :         if ( 0 == rSettings.aFieldMapping.size() )
      84           0 :             sHint = String( ModuleRes( RID_STR_NOFIELDSASSIGNED ) );
      85           0 :         m_aHint.SetText( sHint );
      86           0 :     }
      87             : 
      88             :     //---------------------------------------------------------------------
      89           0 :     IMPL_LINK( FieldMappingPage, OnInvokeDialog, void*, /*NOTINTERESTEDIN*/ )
      90             :     {
      91           0 :         AddressSettings& rSettings = getSettings();
      92             : 
      93             :         // invoke the dialog doing the mapping
      94           0 :         if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) )
      95             :         {
      96           0 :             if ( rSettings.aFieldMapping.size() )
      97           0 :                 getDialog()->travelNext();
      98             :             else
      99           0 :                 implUpdateHint();
     100             :         }
     101             : 
     102           0 :         return 0L;
     103             :     }
     104             : 
     105             : //.........................................................................
     106             : }   // namespace abp
     107             : //.........................................................................
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10