bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / dbadmin.hxx
blobfb5758db17a0a04794510e66a4e0b945addde3ae
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 _DBAUI_DBADMIN_HXX_
21 #define _DBAUI_DBADMIN_HXX_
23 #include <sfx2/tabdlg.hxx>
24 #include "dsntypes.hxx"
25 #include "IItemSetHelper.hxx"
26 #include <comphelper/uno3.hxx>
27 #include <memory>
29 namespace com { namespace sun { namespace star {
30 namespace beans {
31 class XPropertySet;
33 namespace sdbc {
34 class XConnection;
36 namespace lang {
37 class XMultiServiceFactory;
39 }}}
41 //.........................................................................
42 namespace dbaui
44 //.........................................................................
46 //=========================================================================
47 //= ODbAdminDialog
48 //=========================================================================
49 class ODbDataSourceAdministrationHelper;
50 /** tab dialog for administrating the office wide registered data sources
52 class ODbAdminDialog : public SfxTabDialog , public IItemSetHelper, public IDatabaseSettingsDialog
54 private:
55 typedef ::std::stack< sal_Int32 > PageStack;
56 PageStack m_aCurrentDetailPages; // ids of all currently enabled (type-dependent) detail pages
58 ::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
60 sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
61 sal_Bool m_bUIEnabled : 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
62 sal_uInt16 m_nMainPageID;
64 public:
65 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
66 after the dialog has been destroyed
68 ODbAdminDialog(Window* pParent,
69 SfxItemSet* _pItems,
70 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
72 virtual ~ODbAdminDialog();
74 /** create and return an item set for use with the dialog.
75 @param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
76 the pool will not contain a typecollection default.
78 static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
79 /** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
81 static void destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults);
83 /** selects the DataSource
84 @param _rName
85 The name of the data source
87 void selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName);
89 virtual const SfxItemSet* getOutputSet() const;
90 virtual SfxItemSet* getWriteOutputSet();
92 // forwards to ODbDataSourceAdministrationHelper
93 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const;
94 virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
95 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
96 virtual OUString getDatasourceType(const SfxItemSet& _rSet) const;
97 virtual void clearPassword();
98 virtual sal_Bool saveDatasource();
99 virtual void setTitle(const OUString& _sTitle);
100 virtual void enableConfirmSettings( bool _bEnable );
102 protected:
103 // adds a new detail page and remove all the old ones
104 void addDetailPage(sal_uInt16 _nPageId,sal_uInt16 _nTextId,CreateTabPage pCreateFunc);
106 virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage);
107 virtual short Ok();
109 protected:
110 inline sal_Bool isUIEnabled() const { return m_bUIEnabled; }
111 inline void disabledUI() { m_bUIEnabled = sal_False; }
113 private:
114 /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
115 void impl_selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName);
116 /// reset the tag pages according to m_sCurrentDatasource and <arg>_rxDatasource</arg>
117 void impl_resetPages(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatasource);
119 enum ApplyResult
121 AR_LEAVE_MODIFIED, // something was modified and has successfully been committed
122 AR_LEAVE_UNCHANGED, // no changes were made
123 AR_KEEP // don't leave the page (e.g. because an error occurred)
125 /** apply all changes made
127 ApplyResult implApplyChanges();
130 //.........................................................................
131 } // namespace dbaui
132 //.........................................................................
134 #endif // _DBAUI_DBADMIN_HXX_
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */