From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 308 ++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx (limited to 'dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx') diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx new file mode 100644 index 0000000000..909cfede58 --- /dev/null +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -0,0 +1,308 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "ConnectionPageSetup.hxx" + +#include "adminpages.hxx" +#include "admincontrols.hxx" +#include "TextConnectionHelper.hxx" + +#include + +namespace dbaui +{ + class ODbTypeWizDialogSetup; + + // OSpreadSheetConnectionPageSetup + class OSpreadSheetConnectionPageSetup final : public OConnectionTabPageSetup + { + public: + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; + static std::unique_ptr CreateDocumentOrSpreadSheetTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet); + OSpreadSheetConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs); + virtual ~OSpreadSheetConnectionPageSetup() override; + + private: + std::unique_ptr m_xPasswordrequired; + + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + }; + + // OTextConnectionPage + class OTextConnectionPageSetup : public OConnectionTabPageSetup + { + public: + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; + static std::unique_ptr CreateTextTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); + OTextConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs); + virtual ~OTextConnectionPageSetup() override; + protected: + virtual bool prepareLeave() override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + bool checkTestConnection() override; + private: + DECL_LINK(ImplGetExtensionHdl, OTextConnectionHelper*, void); + std::unique_ptr m_xSubContainer; + std::unique_ptr m_xTextConnectionHelper; + }; + + // OLDAPConnectionPageSetup + class OLDAPConnectionPageSetup : public OGenericAdministrationPage + { + public: + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; + static std::unique_ptr CreateLDAPTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); + OLDAPConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ); + virtual ~OLDAPConnectionPageSetup() override; + virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override; + + protected: + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + + private: + std::unique_ptr m_xFTHelpText; + std::unique_ptr m_xFTHostServer; + std::unique_ptr m_xETHostServer; + std::unique_ptr m_xFTBaseDN; + std::unique_ptr m_xETBaseDN; + std::unique_ptr m_xFTPortNumber; + std::unique_ptr m_xNFPortNumber; + std::unique_ptr m_xFTDefaultPortNumber; + std::unique_ptr m_xCBUseSSL; + }; + + // MySQLNativeSetupPage + class MySQLNativeSetupPage : public OGenericAdministrationPage + { + private: + std::unique_ptr m_xHelpText; + std::unique_ptr m_xSettingsContainer; + std::unique_ptr m_xMySQLSettings; + + public: + MySQLNativeSetupPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs); + virtual ~MySQLNativeSetupPage() override; + + static std::unique_ptr Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + + protected: + virtual void fillControls( std::vector< std::unique_ptr >& _rControlList ) override; + virtual void fillWindows( std::vector< std::unique_ptr >& _rControlList ) override; + + virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + + virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override; + }; + + // OGeneralSpecialJDBCConnectionPageSetup + class OGeneralSpecialJDBCConnectionPageSetup final : public OGenericAdministrationPage + { + public: + OGeneralSpecialJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController + , const SfxItemSet& _rCoreAttrs + , sal_uInt16 _nPortId + , TranslateId pDefaultPortResId + , TranslateId pHelpTextResId + , TranslateId pHeaderTextResId + , TranslateId pDriverClassId ); + virtual ~OGeneralSpecialJDBCConnectionPageSetup() override; + static std::unique_ptr CreateMySQLJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); + static std::unique_ptr CreateOracleJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); + + private: + virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override; + + DECL_LINK(OnTestJavaClickHdl, weld::Button&, void); + + OUString m_sDefaultJdbcDriverName; + TypedWhichId m_nPortId; + + std::unique_ptr m_xHeaderText; + std::unique_ptr m_xFTHelpText; + std::unique_ptr m_xFTDatabasename; + std::unique_ptr m_xETDatabasename; + std::unique_ptr m_xFTHostname; + std::unique_ptr m_xETHostname; + std::unique_ptr m_xFTPortNumber; + std::unique_ptr m_xFTDefaultPortNumber; + std::unique_ptr m_xNFPortNumber; + + std::unique_ptr m_xFTDriverClass; + std::unique_ptr m_xETDriverClass; + std::unique_ptr m_xPBTestJavaDriver; + }; + + // OJDBCConnectionPageSetup + class OJDBCConnectionPageSetup final : public OConnectionTabPageSetup + { + public: + OJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs); + virtual ~OJDBCConnectionPageSetup() override; + static std::unique_ptr CreateJDBCTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + + private: + virtual bool checkTestConnection() override; + + virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + + DECL_LINK(OnTestJavaClickHdl, weld::Button&, void); + DECL_LINK(OnEditModified, weld::Entry&, void); + std::unique_ptr m_xFTDriverClass; + std::unique_ptr m_xETDriverClass; + std::unique_ptr m_xPBTestJavaDriver; + }; + + // OMySQLIntroPageSetup + class OMySQLIntroPageSetup : public OGenericAdministrationPage + { + public: + enum ConnectionType + { + VIA_ODBC, + VIA_JDBC, + VIA_NATIVE + }; + + OMySQLIntroPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rCoreAttrs); + virtual ~OMySQLIntroPageSetup() override; + + static std::unique_ptr CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet); + ConnectionType getMySQLMode() const; + void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } + + protected: + virtual bool FillItemSet(SfxItemSet* _rSet) override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + + private: + std::unique_ptr m_xODBCDatabase; + std::unique_ptr m_xJDBCDatabase; + std::unique_ptr m_xNATIVEDatabase; + Link maClickHdl; + + DECL_LINK(OnSetupModeSelected, weld::Toggleable&, void); + }; + + // OPostgresPageSetup + class OPostgresConnectionPageSetup final : public OGenericAdministrationPage + { + public: + OPostgresConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController + , const SfxItemSet& _rCoreAttrs + , sal_uInt16 _nPortId ); + virtual ~OPostgresConnectionPageSetup() override; + static std::unique_ptr CreatePostgresTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); + ::dbaccess::ODsnTypeCollection* m_pCollection; + + private: + virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override; + + TypedWhichId m_nPortId; + + std::unique_ptr m_xETDatabasename; + std::unique_ptr m_xETHostname; + std::unique_ptr m_xNFPortNumber; + std::unique_ptr m_xConnectionURL; + + /** used for the connection URL + @param _rURL + The URL to check. + */ + void impl_setURL( std::u16string_view _rURL, bool _bPrefix ); + void setURLNoPrefix( std::u16string_view _rURL ); + void setURL( std::u16string_view _rURL ); + bool commitURL(); + }; + + + // OAuthentificationPageSetup + class OAuthentificationPageSetup final : public OGenericAdministrationPage + { + public: + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; + static std::unique_ptr CreateAuthentificationTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet); + OAuthentificationPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs); + virtual ~OAuthentificationPageSetup() override; + + private: + std::unique_ptr m_xFTHelpText; + std::unique_ptr m_xFTUserName; + std::unique_ptr m_xETUserName; + std::unique_ptr m_xCBPasswordRequired; + std::unique_ptr m_xPBTestConnection; + + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + }; + + // OFinalDBPageSetup + class OFinalDBPageSetup : public OGenericAdministrationPage + { + public: + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; + static std::unique_ptr CreateFinalDBTabPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rAttrSet); + + OFinalDBPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs); + virtual ~OFinalDBPageSetup() override; + bool IsDatabaseDocumentToBeRegistered() const; + bool IsDatabaseDocumentToBeOpened() const; + bool IsTableWizardToBeStarted() const; + void enableTableWizardCheckBox( bool _bSupportsTableCreation); + + DECL_LINK(OnOpenSelected, weld::Toggleable&, void); + protected: + virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; + virtual void fillControls(std::vector< std::unique_ptr >& _rControlList) override; + virtual void fillWindows(std::vector< std::unique_ptr >& _rControlList) override; + private: + std::unique_ptr m_xFTFinalHeader; + std::unique_ptr m_xFTFinalHelpText; + std::unique_ptr m_xRBRegisterDataSource; + std::unique_ptr m_xRBDontregisterDataSource; + std::unique_ptr m_xFTAdditionalSettings; + std::unique_ptr m_xCBOpenAfterwards; + std::unique_ptr m_xCBStartTableWizard; + std::unique_ptr m_xFTFinalText; + }; + +} // namespace dbaui + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3