bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / abpilot / abspilot.hxx
blob8982e71010cbed8b28a6ebd992a6bfcc09dbc3dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 EXTENSIONS_ABSPILOT_HXX
21 #define EXTENSIONS_ABSPILOT_HXX
23 #include <svtools/roadmapwizard.hxx>
24 #include "addresssettings.hxx"
25 #include <vcl/fixed.hxx>
26 #include "datasourcehandling.hxx"
28 //.........................................................................
29 namespace abp
31 //.........................................................................
33 //=====================================================================
34 //= OAddessBookSourcePilot
35 //=====================================================================
36 typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base;
37 class OAddessBookSourcePilot : public OAddessBookSourcePilot_Base
39 protected:
40 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
41 m_xORB;
42 AddressSettings m_aSettings;
44 ODataSource m_aNewDataSource;
45 AddressSourceType m_eNewDataSourceType;
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 ~OAddessBookSourcePilot();
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 getORB() { return m_xORB; }
58 AddressSettings& getSettings() { return m_aSettings; }
59 const AddressSettings& getSettings() const { return m_aSettings; }
61 const ODataSource& getDataSource() const { return m_aNewDataSource; }
63 sal_Bool connectToDataSource( sal_Bool _bForceReConnect );
65 void travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); }
67 /// to be called when the selected type changed
68 void typeSelectionChanged( AddressSourceType _eType );
70 protected:
71 // OWizardMachine overridables
72 virtual ::svt::OWizardPage* createPage( WizardState _nState );
73 virtual void enterState( WizardState _nState );
74 virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason );
75 virtual sal_Bool onFinish();
77 // RoadmapWizard
78 virtual String getStateDisplayName( WizardState _nState ) const;
80 virtual sal_Bool Close();
82 private:
83 DECL_LINK( OnCancelClicked, void* );
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>
88 void implCreateDataSource();
90 /// does an automatic field mapping (possible for all types except AST_OTHER)
91 void implDoAutoFieldMapping();
93 /// guesses a default for the table name, if no valid table is selected
94 void implDefaultTableName();
96 inline sal_Bool needAdminInvokationPage( AddressSourceType _eType ) const
98 return ( ( AST_LDAP == _eType )
99 || ( AST_OTHER == _eType )
102 /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source
103 inline sal_Bool needAdminInvokationPage() const
105 return needAdminInvokationPage( m_aSettings.eType );
108 inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const
110 return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) ||
111 ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) ||
112 ( AST_EVOLUTION_LDAP == _eType );
114 /// checks if we need a manual (user-guided) field mapping
115 inline sal_Bool needManualFieldMapping() const
117 return needManualFieldMapping( m_aSettings.eType );
120 /// determines whether the given address book type does provide one table only
121 inline bool needTableSelection( AddressSourceType _eType ) const
123 return ( AST_LDAP != _eType ) && ( AST_KAB != _eType );
126 inline bool needTableSelection() const
128 return needTableSelection( m_aSettings.eType );
131 void implCleanup();
132 void implCommitAll();
134 void impl_updateRoadmap( AddressSourceType _eType );
137 //.........................................................................
138 } // namespace abp
139 //.........................................................................
141 #endif // EXTENSIONS_ABSPILOT_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */