LCOV - code coverage report
Current view: top level - extensions/source/abpilot - abspilot.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 18 0.0 %
Date: 2014-04-14 Functions: 0 10 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             : #ifndef EXTENSIONS_ABSPILOT_HXX
      21             : #define EXTENSIONS_ABSPILOT_HXX
      22             : 
      23             : #include <svtools/roadmapwizard.hxx>
      24             : #include "addresssettings.hxx"
      25             : #include <vcl/fixed.hxx>
      26             : #include "datasourcehandling.hxx"
      27             : 
      28             : 
      29             : namespace abp
      30             : {
      31             : 
      32             : 
      33             : 
      34             :     //= OAddessBookSourcePilot
      35             : 
      36             :     typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base;
      37             :     class OAddessBookSourcePilot : public OAddessBookSourcePilot_Base
      38             :     {
      39             :     protected:
      40             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
      41             :                                 m_xORB;
      42             :         AddressSettings         m_aSettings;
      43             : 
      44             :         ODataSource             m_aNewDataSource;
      45             :         AddressSourceType       m_eNewDataSourceType;
      46             : 
      47             :     public:
      48             :         /// ctor
      49             :         OAddessBookSourcePilot(
      50             :             Window* _pParent,
      51             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
      52             :         /// dtor
      53             :         virtual ~OAddessBookSourcePilot();
      54             : 
      55             :         /// get the service factory which was used to create the dialog
      56             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
      57           0 :                                 getORB() { return m_xORB; }
      58           0 :         AddressSettings&        getSettings() { return m_aSettings; }
      59           0 :         const AddressSettings&  getSettings() const { return m_aSettings; }
      60             : 
      61           0 :         const ODataSource&      getDataSource() const { return m_aNewDataSource; }
      62             : 
      63             :         sal_Bool                connectToDataSource( sal_Bool _bForceReConnect );
      64             : 
      65           0 :         void                    travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); }
      66             : 
      67             :         /// to be called when the selected type changed
      68             :         void                    typeSelectionChanged( AddressSourceType _eType );
      69             : 
      70             :     protected:
      71             :         // OWizardMachine overridables
      72             :         virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
      73             :         virtual void                enterState( WizardState _nState ) SAL_OVERRIDE;
      74             :         virtual bool                prepareLeaveCurrentState( CommitPageReason _eReason ) SAL_OVERRIDE;
      75             :         virtual bool                onFinish() SAL_OVERRIDE;
      76             : 
      77             :         // RoadmapWizard
      78             :         virtual OUString            getStateDisplayName( WizardState _nState ) const SAL_OVERRIDE;
      79             : 
      80             :         virtual bool    Close() SAL_OVERRIDE;
      81             : 
      82             :     private:
      83             :         DECL_LINK( OnCancelClicked, void* );
      84             : 
      85             :         /** creates a new data source of the type indicated by m_aSettings
      86             :             <p>If another data source has been created before, this one is deleted.</p>
      87             :         */
      88             :         void implCreateDataSource();
      89             : 
      90             :         /// does an automatic field mapping (possible for all types except AST_OTHER)
      91             :         void implDoAutoFieldMapping();
      92             : 
      93             :         /// guesses a default for the table name, if no valid table is selected
      94             :         void implDefaultTableName();
      95             : 
      96           0 :         inline sal_Bool needAdminInvokationPage( AddressSourceType _eType ) const
      97             :         {
      98             :             return  (   ( AST_LDAP == _eType )
      99           0 :                     ||  ( AST_OTHER == _eType )
     100           0 :                     );
     101             :         }
     102             :         /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source
     103           0 :         inline sal_Bool needAdminInvokationPage() const
     104             :         {
     105           0 :             return  needAdminInvokationPage( m_aSettings.eType );
     106             :         }
     107             : 
     108           0 :         inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const
     109             :         {
     110           0 :             return  ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) ||
     111           0 :                     ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) ||
     112           0 :                     ( AST_EVOLUTION_LDAP == _eType );
     113             :         }
     114             :         /// checks if we need a manual (user-guided) field mapping
     115           0 :         inline sal_Bool needManualFieldMapping() const
     116             :         {
     117           0 :             return needManualFieldMapping( m_aSettings.eType );
     118             :         }
     119             : 
     120             :         /// determines whether the given address book type does provide one table only
     121           0 :         inline bool needTableSelection( AddressSourceType _eType ) const
     122             :         {
     123           0 :             return  ( AST_LDAP != _eType ) && ( AST_KAB != _eType );
     124             :         }
     125             : 
     126             :         inline bool needTableSelection() const
     127             :         {
     128             :             return needTableSelection( m_aSettings.eType );
     129             :         }
     130             : 
     131             :         void implCleanup();
     132             :         void implCommitAll();
     133             : 
     134             :         void impl_updateRoadmap( AddressSourceType _eType );
     135             :     };
     136             : 
     137             : 
     138             : }   // namespace abp
     139             : 
     140             : 
     141             : #endif // EXTENSIONS_ABSPILOT_HXX
     142             : 
     143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10