1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ABSPILOT_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ABSPILOT_HXX
23 #include <svtools/roadmapwizard.hxx>
24 #include "addresssettings.hxx"
25 #include <vcl/fixed.hxx>
26 #include "datasourcehandling.hxx"
32 typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base
;
33 class OAddessBookSourcePilot
: public OAddessBookSourcePilot_Base
36 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
38 AddressSettings m_aSettings
;
40 ODataSource m_aNewDataSource
;
41 AddressSourceType m_eNewDataSourceType
;
45 OAddessBookSourcePilot(
46 vcl::Window
* _pParent
,
47 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
);
49 /// get the service factory which was used to create the dialog
50 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>&
51 getORB() { return m_xORB
; }
52 AddressSettings
& getSettings() { return m_aSettings
; }
53 const AddressSettings
& getSettings() const { return m_aSettings
; }
55 const ODataSource
& getDataSource() const { return m_aNewDataSource
; }
57 bool connectToDataSource( bool _bForceReConnect
);
59 void travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); }
61 /// to be called when the selected type changed
62 void typeSelectionChanged( AddressSourceType _eType
);
65 // OWizardMachine overridables
66 virtual VclPtr
<TabPage
> createPage( WizardState _nState
) SAL_OVERRIDE
;
67 virtual void enterState( WizardState _nState
) SAL_OVERRIDE
;
68 virtual bool prepareLeaveCurrentState( CommitPageReason _eReason
) SAL_OVERRIDE
;
69 virtual bool onFinish() SAL_OVERRIDE
;
72 virtual OUString
getStateDisplayName( WizardState _nState
) const SAL_OVERRIDE
;
74 virtual bool Close() SAL_OVERRIDE
;
77 DECL_LINK( OnCancelClicked
, void* );
79 /** creates a new data source of the type indicated by m_aSettings
80 <p>If another data source has been created before, this one is deleted.</p>
82 void implCreateDataSource();
84 /// does an automatic field mapping (possible for all types except AST_OTHER)
85 void implDoAutoFieldMapping();
87 /// guesses a default for the table name, if no valid table is selected
88 void implDefaultTableName();
90 static inline bool needAdminInvokationPage( AddressSourceType _eType
)
92 return ( ( AST_LDAP
== _eType
)
93 || ( AST_OTHER
== _eType
)
96 /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source
97 inline bool needAdminInvokationPage() const
99 return needAdminInvokationPage( m_aSettings
.eType
);
102 static inline bool needManualFieldMapping( AddressSourceType _eType
)
104 return ( AST_OTHER
== _eType
) || ( AST_KAB
== _eType
) ||
105 ( AST_EVOLUTION
== _eType
) || ( AST_EVOLUTION_GROUPWISE
== _eType
) ||
106 ( AST_EVOLUTION_LDAP
== _eType
);
108 /// checks if we need a manual (user-guided) field mapping
109 inline bool needManualFieldMapping() const
111 return needManualFieldMapping( m_aSettings
.eType
);
114 /// determines whether the given address book type does provide one table only
115 static inline bool needTableSelection( AddressSourceType _eType
)
117 return ( AST_LDAP
!= _eType
) && ( AST_KAB
!= _eType
);
120 inline bool needTableSelection() const
122 return needTableSelection( m_aSettings
.eType
);
126 void implCommitAll();
128 void impl_updateRoadmap( AddressSourceType _eType
);
135 #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ABSPILOT_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */