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

Generated by: LCOV version 1.10