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

Generated by: LCOV version 1.10