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