LibreOffice Module dbaccess (master) 1
dbadmin.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sfx2/tabdlg.hxx>
23#include <dsntypes.hxx>
24#include "IItemSetHelper.hxx"
25#include <unotools/resmgr.hxx>
26#include <memory>
27
28namespace com::sun::star {
29 namespace beans {
30 class XPropertySet;
31 }
32 namespace sdbc {
33 class XConnection;
34 }
35 namespace lang {
36 class XMultiServiceFactory;
37 }
38}
39
40namespace dbaui
41{
42
43// ODbAdminDialog
44class ODbDataSourceAdministrationHelper;
48{
49private:
50 std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
51
52 OUString m_sMainPageID;
53
54public:
58 ODbAdminDialog(weld::Window* pParent, SfxItemSet const * _pItems,
59 const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
60 virtual ~ODbAdminDialog() override;
61
66 static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
69 static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
70
75 void selectDataSource(const css::uno::Any& _aDataSourceName);
76
77 virtual const SfxItemSet* getOutputSet() const override;
78 virtual SfxItemSet* getWriteOutputSet() override;
79
80 // forwards to ODbDataSourceAdministrationHelper
81 virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
82 virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
83 virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
84 virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
85 virtual void clearPassword() override;
86 virtual void saveDatasource() override;
87 virtual void setTitle(const OUString& _sTitle) override;
88 virtual void enableConfirmSettings( bool _bEnable ) override;
89
90private:
91 // adds a new detail page and remove all the old ones
92 void addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc);
93
94 virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override;
95 virtual short Ok() override;
96
98 void impl_selectDataSource(const css::uno::Any& _aDataSourceName);
100 void impl_resetPages(const css::uno::Reference< css::beans::XPropertySet >& _rxDatasource);
101
103 {
104 AR_LEAVE_MODIFIED, // something was modified and has successfully been committed
105 AR_KEEP // don't leave the page (e.g. because an error occurred)
106 };
110};
111
112} // namespace dbaui
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tab dialog for administrating the office wide registered data sources
Definition: dbadmin.hxx:48
std::unique_ptr< ODbDataSourceAdministrationHelper > m_pImpl
Definition: dbadmin.hxx:50
virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override
Definition: dbadmin.cxx:252
static void destroyItemSet(std::unique_ptr< SfxItemSet > &_rpSet, rtl::Reference< SfxItemPool > &_rpPool, std::vector< SfxPoolItem * > *&_rpDefaults)
destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
Definition: dbadmin.cxx:415
void selectDataSource(const css::uno::Any &_aDataSourceName)
selects the DataSource
Definition: dbadmin.cxx:227
virtual SfxItemSet * getWriteOutputSet() override
Definition: dbadmin.cxx:237
virtual void clearPassword() override
Definition: dbadmin.cxx:262
void addDetailPage(const OUString &rPageId, TranslateId pTextId, CreateTabPage pCreateFunc)
Definition: dbadmin.cxx:83
OUString m_sMainPageID
Definition: dbadmin.hxx:52
virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override
Definition: dbadmin.cxx:247
virtual std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > createConnection() override
Definition: dbadmin.cxx:242
virtual void enableConfirmSettings(bool _bEnable) override
enables or disables the user's possibility to confirm the settings
Definition: dbadmin.cxx:207
static void createItemSet(std::unique_ptr< SfxItemSet > &_rpSet, rtl::Reference< SfxItemPool > &_rpPool, std::vector< SfxPoolItem * > *&_rpDefaults, ::dbaccess::ODsnTypeCollection *_pTypeCollection)
create and return an item set for use with the dialog.
Definition: dbadmin.cxx:267
virtual short Ok() override
Definition: dbadmin.cxx:67
void impl_selectDataSource(const css::uno::Any &_aDataSourceName)
select a datasource with a given name, adjust the item set accordingly, and everything like that ....
Definition: dbadmin.cxx:88
virtual const SfxItemSet * getOutputSet() const override
Definition: dbadmin.cxx:232
virtual void saveDatasource() override
Definition: dbadmin.cxx:209
virtual ~ODbAdminDialog() override
Definition: dbadmin.cxx:62
virtual void PageCreated(const OUString &rId, SfxTabPage &_rPage) override
Definition: dbadmin.cxx:74
ApplyResult implApplyChanges()
apply all changes made
Definition: dbadmin.cxx:214
ODbAdminDialog(weld::Window *pParent, SfxItemSet const *_pItems, const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
ctor.
Definition: dbadmin.cxx:47
virtual OUString getDatasourceType(const SfxItemSet &_rSet) const override
Definition: dbadmin.cxx:257
virtual void setTitle(const OUString &_sTitle) override
Definition: dbadmin.cxx:202
void impl_resetPages(const css::uno::Reference< css::beans::XPropertySet > &_rxDatasource)
reset the tag pages according to m_sCurrentDatasource and <arg>_rxDatasource</arg>
Definition: dbadmin.cxx:153
class SAL_NO_VTABLE XPropertySet