Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / dbpilots / commonpagesdbp.hxx
blob5d93b93012713109bbe6f691b6862ee96bfb71be
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_DBPILOTS_COMMONPAGESDBP_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX
23 #include "controlwizard.hxx"
24 #include <vcl/weld.hxx>
25 #include <com/sun/star/sdb/XDatabaseContext.hpp>
27 namespace dbp
29 class OTableSelectionPage final : public OControlWizardPage
31 std::unique_ptr<weld::TreeView> m_xTable;
32 std::unique_ptr<weld::TreeView> m_xDatasource;
33 std::unique_ptr<weld::Label> m_xDatasourceLabel;
34 std::unique_ptr<weld::Button> m_xSearchDatabase;
35 std::unique_ptr<weld::Container> m_xSourceBox;
37 css::uno::Reference< css::sdb::XDatabaseContext >
38 m_xDSContext;
40 public:
41 explicit OTableSelectionPage(weld::Container* pPage, OControlWizard* pParent);
42 virtual ~OTableSelectionPage() override;
44 private:
45 // BuilderPage overridables
46 void Activate() override;
48 // OWizardPage overridables
49 virtual void initializePage() override;
50 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
52 DECL_LINK( OnListboxSelection, weld::TreeView&, void );
53 DECL_LINK( OnListboxDoubleClicked, weld::TreeView&, bool );
54 DECL_LINK( OnSearchClicked, weld::Button&, void );
56 void implFillTables(const css::uno::Reference< css::sdbc::XConnection >&
57 _rxConn = css::uno::Reference< css::sdbc::XConnection >());
59 // OControlWizardPage overridables
60 virtual bool canAdvance() const override;
63 class OMaybeListSelectionPage : public OControlWizardPage
65 weld::RadioButton* m_pYes;
66 weld::RadioButton* m_pNo;
67 weld::ComboBox* m_pList;
69 public:
70 OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID);
71 virtual ~OMaybeListSelectionPage() override;
73 protected:
74 DECL_LINK( OnRadioSelected, weld::Button&, void );
76 // BuilderPage overridables
77 void Activate() override;
79 // own helper
80 void announceControls(
81 weld::RadioButton& _rYesButton,
82 weld::RadioButton& _rNoButton,
83 weld::ComboBox& _rSelection);
85 void implEnableWindows();
87 void implInitialize(const OUString& _rSelection);
88 void implCommit(OUString& _rSelection);
91 class ODBFieldPage : public OMaybeListSelectionPage
93 protected:
94 std::unique_ptr<weld::Label> m_xDescription;
95 std::unique_ptr<weld::RadioButton> m_xStoreYes;
96 std::unique_ptr<weld::RadioButton> m_xStoreNo;
97 std::unique_ptr<weld::ComboBox> m_xStoreWhere;
99 public:
100 explicit ODBFieldPage(weld::Container* pPage, OControlWizard* pWizard);
101 virtual ~ODBFieldPage() override;
103 protected:
104 void setDescriptionText(const OUString& rDesc)
106 m_xDescription->set_label(rDesc);
109 // OWizardPage overridables
110 virtual void initializePage() override;
111 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
113 // own overridables
114 virtual OUString& getDBFieldSetting() = 0;
118 } // namespace dbp
121 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */