bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / abpilot / abspilot.hxx
blobb55122eebf84a08b6d7328dc8daf7d65c598f957
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 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"
29 namespace abp
32 typedef ::svt::RoadmapWizard OAddressBookSourcePilot_Base;
33 class OAddressBookSourcePilot final : public OAddressBookSourcePilot_Base
35 css::uno::Reference< css::uno::XComponentContext >
36 m_xORB;
37 AddressSettings m_aSettings;
39 ODataSource m_aNewDataSource;
40 AddressSourceType m_eNewDataSourceType;
42 public:
43 /// ctor
44 OAddressBookSourcePilot(
45 vcl::Window* _pParent,
46 const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
48 /// get the service factory which was used to create the dialog
49 const css::uno::Reference< css::uno::XComponentContext >&
50 getORB() { return m_xORB; }
51 AddressSettings& getSettings() { return m_aSettings; }
52 const AddressSettings& getSettings() const { return m_aSettings; }
54 const ODataSource& getDataSource() const { return m_aNewDataSource; }
56 bool connectToDataSource( bool _bForceReConnect );
58 void travelNext( ) { OAddressBookSourcePilot_Base::travelNext(); }
60 /// to be called when the selected type changed
61 void typeSelectionChanged( AddressSourceType _eType );
63 private:
64 // OWizardMachine overridables
65 virtual VclPtr<TabPage> createPage( WizardState _nState ) override;
66 virtual void enterState( WizardState _nState ) override;
67 virtual bool prepareLeaveCurrentState( CommitPageReason _eReason ) override;
68 virtual bool onFinish() override;
70 // RoadmapWizard
71 virtual OUString getStateDisplayName( WizardState _nState ) const override;
73 virtual bool Close() override;
75 DECL_LINK( OnCancelClicked, Button*, void );
77 /** creates a new data source of the type indicated by m_aSettings
78 <p>If another data source has been created before, this one is deleted.</p>
80 void implCreateDataSource();
82 /// does an automatic field mapping (possible for all types except AST_OTHER)
83 void implDoAutoFieldMapping();
85 /// guesses a default for the table name, if no valid table is selected
86 void implDefaultTableName();
88 static bool needAdminInvokationPage( AddressSourceType _eType )
90 return ( AST_OTHER == _eType );
92 /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source
93 bool needAdminInvokationPage() const
95 return needAdminInvokationPage( m_aSettings.eType );
98 static bool needManualFieldMapping( AddressSourceType _eType )
100 return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) ||
101 ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) ||
102 ( AST_EVOLUTION_LDAP == _eType );
104 /// checks if we need a manual (user-guided) field mapping
105 bool needManualFieldMapping() const
107 return needManualFieldMapping( m_aSettings.eType );
110 /// determines whether the given address book type does provide one table only
111 static bool needTableSelection( AddressSourceType _eType )
113 return ( AST_KAB != _eType );
116 void implCleanup();
117 void implCommitAll();
119 void impl_updateRoadmap( AddressSourceType _eType );
123 } // namespace abp
126 #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ABSPILOT_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */