LCOV - code coverage report
Current view: top level - extensions/source/abpilot - abspilot.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 15 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef EXTENSIONS_ABSPILOT_HXX
      30                 :            : #define EXTENSIONS_ABSPILOT_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      33                 :            : #include <svtools/roadmapwizard.hxx>
      34                 :            : #include "addresssettings.hxx"
      35                 :            : #include <vcl/fixed.hxx>
      36                 :            : #include "datasourcehandling.hxx"
      37                 :            : 
      38                 :            : //.........................................................................
      39                 :            : namespace abp
      40                 :            : {
      41                 :            : //.........................................................................
      42                 :            : 
      43                 :            :     //=====================================================================
      44                 :            :     //= OAddessBookSourcePilot
      45                 :            :     //=====================================================================
      46                 :            :     typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base;
      47                 :            :     class OAddessBookSourcePilot : public OAddessBookSourcePilot_Base
      48                 :            :     {
      49                 :            :     protected:
      50                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
      51                 :            :                                 m_xORB;
      52                 :            :         AddressSettings         m_aSettings;
      53                 :            : 
      54                 :            :         ODataSource             m_aNewDataSource;
      55                 :            :         AddressSourceType       m_eNewDataSourceType;
      56                 :            : 
      57                 :            :     public:
      58                 :            :         /// ctor
      59                 :            :         OAddessBookSourcePilot(
      60                 :            :             Window* _pParent,
      61                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
      62                 :            :         /// dtor
      63                 :            :         ~OAddessBookSourcePilot();
      64                 :            : 
      65                 :            :         /// get the service factory which was used to create the dialog
      66                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
      67                 :          0 :                                 getORB() { return m_xORB; }
      68                 :          0 :         AddressSettings&        getSettings() { return m_aSettings; }
      69                 :          0 :         const AddressSettings&  getSettings() const { return m_aSettings; }
      70                 :            : 
      71                 :          0 :         const ODataSource&      getDataSource() const { return m_aNewDataSource; }
      72                 :            : 
      73                 :            :         sal_Bool                connectToDataSource( sal_Bool _bForceReConnect );
      74                 :            : 
      75                 :          0 :         void                    travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); }
      76                 :            : 
      77                 :            :         /// to be called when the selected type changed
      78                 :            :         void                    typeSelectionChanged( AddressSourceType _eType );
      79                 :            : 
      80                 :            :     protected:
      81                 :            :         // OWizardMachine overridables
      82                 :            :         virtual ::svt::OWizardPage* createPage( WizardState _nState );
      83                 :            :         virtual void                enterState( WizardState _nState );
      84                 :            :         virtual sal_Bool            prepareLeaveCurrentState( CommitPageReason _eReason );
      85                 :            :         virtual sal_Bool            onFinish();
      86                 :            : 
      87                 :            :         // RoadmapWizard
      88                 :            :         virtual String              getStateDisplayName( WizardState _nState ) const;
      89                 :            : 
      90                 :            :         virtual sal_Bool    Close();
      91                 :            : 
      92                 :            :     private:
      93                 :            :         DECL_LINK( OnCancelClicked, void* );
      94                 :            : 
      95                 :            :         /** creates a new data source of the type indicated by m_aSettings
      96                 :            :             <p>If another data source has been created before, this one is deleted.</p>
      97                 :            :         */
      98                 :            :         void implCreateDataSource();
      99                 :            : 
     100                 :            :         /// does an automatic field mapping (possible for all types except AST_OTHER)
     101                 :            :         void implDoAutoFieldMapping();
     102                 :            : 
     103                 :            :         /// guesses a default for the table name, if no valid table is selected
     104                 :            :         void implDefaultTableName();
     105                 :            : 
     106                 :          0 :         inline sal_Bool needAdminInvokationPage( AddressSourceType _eType ) const
     107                 :            :         {
     108                 :            :             return  (   ( AST_LDAP == _eType )
     109                 :            :                     ||  ( AST_OTHER == _eType )
     110                 :          0 :                     );
     111                 :            :         }
     112                 :            :         /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source
     113                 :          0 :         inline sal_Bool needAdminInvokationPage() const
     114                 :            :         {
     115                 :          0 :             return  needAdminInvokationPage( m_aSettings.eType );
     116                 :            :         }
     117                 :            : 
     118                 :          0 :         inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const
     119                 :            :         {
     120                 :            :             return  ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) ||
     121                 :            :                     ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) ||
     122                 :          0 :                     ( AST_EVOLUTION_LDAP == _eType );
     123                 :            :         }
     124                 :            :         /// checks if we need a manual (user-guided) field mapping
     125                 :          0 :         inline sal_Bool needManualFieldMapping() const
     126                 :            :         {
     127                 :          0 :             return needManualFieldMapping( m_aSettings.eType );
     128                 :            :         }
     129                 :            : 
     130                 :            :         /// determines whether the given address book type does provide one table only
     131                 :          0 :         inline bool needTableSelection( AddressSourceType _eType ) const
     132                 :            :         {
     133                 :          0 :             return  ( AST_LDAP != _eType ) && ( AST_KAB != _eType );
     134                 :            :         }
     135                 :            : 
     136                 :            :         inline bool needTableSelection() const
     137                 :            :         {
     138                 :            :             return needTableSelection( m_aSettings.eType );
     139                 :            :         }
     140                 :            : 
     141                 :            :         void implCleanup();
     142                 :            :         void implCommitAll();
     143                 :            : 
     144                 :            :         void impl_updateRoadmap( AddressSourceType _eType );
     145                 :            :     };
     146                 :            : 
     147                 :            : //.........................................................................
     148                 :            : }   // namespace abp
     149                 :            : //.........................................................................
     150                 :            : 
     151                 :            : #endif // EXTENSIONS_ABSPILOT_HXX
     152                 :            : 
     153                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10