LCOV - code coverage report
Current view: top level - extensions/source/abpilot - tableselectionpage.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 47 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 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 "tableselectionpage.hxx"
      21             : #include "abptypes.hxx"
      22             : #include "addresssettings.hxx"
      23             : #include "abspilot.hxx"
      24             : #include <tools/debug.hxx>
      25             : 
      26             : 
      27             : namespace abp
      28             : {
      29             : 
      30           0 :     TableSelectionPage::TableSelectionPage( OAddessBookSourcePilot* _pParent )
      31             :         :AddressBookSourcePage(_pParent, "SelectTablePage",
      32           0 :           "modules/sabpilot/ui/selecttablepage.ui")
      33             :     {
      34           0 :         get(m_pTableList, "table");
      35           0 :         m_pTableList->SetSelectHdl( LINK( this, TableSelectionPage, OnTableSelected ) );
      36           0 :         m_pTableList->SetDoubleClickHdl( LINK( this, TableSelectionPage, OnTableDoubleClicked ) );
      37           0 :     }
      38             : 
      39           0 :     TableSelectionPage::~TableSelectionPage()
      40             :     {
      41           0 :         disposeOnce();
      42           0 :     }
      43             : 
      44           0 :     void TableSelectionPage::dispose()
      45             :     {
      46           0 :         m_pTableList.clear();
      47           0 :         AddressBookSourcePage::dispose();
      48           0 :     }
      49             : 
      50           0 :     void TableSelectionPage::ActivatePage()
      51             :     {
      52           0 :         AddressBookSourcePage::ActivatePage();
      53             : 
      54           0 :         m_pTableList->GrabFocus();
      55           0 :     }
      56             : 
      57             : 
      58           0 :     void TableSelectionPage::DeactivatePage()
      59             :     {
      60           0 :         AddressBookSourcePage::DeactivatePage();
      61           0 :     }
      62             : 
      63             : 
      64           0 :     void TableSelectionPage::initializePage()
      65             :     {
      66           0 :         AddressBookSourcePage::initializePage();
      67             : 
      68           0 :         const AddressSettings& rSettings = getSettings();
      69             : 
      70           0 :         m_pTableList->Clear();
      71             : 
      72             :         // get the table names
      73           0 :         const StringBag& aTableNames = getDialog()->getDataSource().getTableNames();
      74             :         DBG_ASSERT( aTableNames.size() > 1, "TableSelectionPage::initializePage: to be called for more than one table only!");
      75             :             // this page should never bother the user if there is 1 or less tables.
      76             : 
      77             :         // fill the list
      78           0 :         for (   StringBag::const_iterator aTables = aTableNames.begin();
      79           0 :                 aTables != aTableNames.end();
      80             :                 ++aTables
      81             :             )
      82           0 :             m_pTableList->InsertEntry( *aTables );
      83             : 
      84             :         // initially select the proper table
      85           0 :         m_pTableList->SelectEntry( rSettings.sSelectedTable );
      86           0 :     }
      87             : 
      88             : 
      89           0 :     IMPL_LINK( TableSelectionPage, OnTableDoubleClicked, void*, /*NOTINTERESTEDIN*/ )
      90             :     {
      91           0 :         if ( 1 == m_pTableList->GetSelectEntryCount() )
      92           0 :             getDialog()->travelNext();
      93             : 
      94           0 :         return 0L;
      95             :     }
      96             : 
      97             : 
      98           0 :     IMPL_LINK( TableSelectionPage, OnTableSelected, void*, /*NOTINTERESTEDIN*/ )
      99             :     {
     100           0 :         updateDialogTravelUI();
     101           0 :         return 0L;
     102             :     }
     103             : 
     104             : 
     105           0 :     bool TableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     106             :     {
     107           0 :         if (!AddressBookSourcePage::commitPage(_eReason))
     108           0 :             return false;
     109             : 
     110           0 :         AddressSettings& rSettings = getSettings();
     111           0 :         rSettings.sSelectedTable = m_pTableList->GetSelectEntry();
     112             : 
     113           0 :         return true;
     114             :     }
     115             : 
     116             : 
     117           0 :     bool TableSelectionPage::canAdvance() const
     118             :     {
     119           0 :         return  AddressBookSourcePage::canAdvance()
     120           0 :             &&  ( 0 < m_pTableList->GetSelectEntryCount() );
     121             :     }
     122             : 
     123             : 
     124           0 : }   // namespace abp
     125             : 
     126             : 
     127             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11