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