1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include "controlwizard.hxx"
23 #include <vcl/weld.hxx>
24 #include <com/sun/star/sdb/XDatabaseContext.hpp>
28 class OTableSelectionPage final
: public OControlWizardPage
30 std::unique_ptr
<weld::TreeView
> m_xTable
;
31 std::unique_ptr
<weld::TreeView
> m_xDatasource
;
32 std::unique_ptr
<weld::Button
> m_xSearchDatabase
;
33 std::unique_ptr
<weld::Container
> m_xSourceBox
;
35 css::uno::Reference
< css::sdb::XDatabaseContext
>
39 explicit OTableSelectionPage(weld::Container
* pPage
, OControlWizard
* pParent
);
40 virtual ~OTableSelectionPage() override
;
43 // BuilderPage overridables
44 void Activate() override
;
46 // OWizardPage overridables
47 virtual void initializePage() override
;
48 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
50 DECL_LINK( OnListboxSelection
, weld::TreeView
&, void );
51 DECL_LINK( OnListboxDoubleClicked
, weld::TreeView
&, bool );
52 DECL_LINK( OnSearchClicked
, weld::Button
&, void );
54 void implFillTables(const css::uno::Reference
< css::sdbc::XConnection
>&
55 _rxConn
= css::uno::Reference
< css::sdbc::XConnection
>());
57 // OControlWizardPage overridables
58 virtual bool canAdvance() const override
;
61 class OMaybeListSelectionPage
: public OControlWizardPage
63 weld::RadioButton
* m_pYes
;
64 weld::RadioButton
* m_pNo
;
65 weld::ComboBox
* m_pList
;
68 OMaybeListSelectionPage(weld::Container
* pPage
, OControlWizard
* pWizard
, const OUString
& rUIXMLDescription
, const OUString
& rID
);
69 virtual ~OMaybeListSelectionPage() override
;
72 DECL_LINK( OnRadioSelected
, weld::Toggleable
&, void );
74 // BuilderPage overridables
75 void Activate() override
;
78 void announceControls(
79 weld::RadioButton
& _rYesButton
,
80 weld::RadioButton
& _rNoButton
,
81 weld::ComboBox
& _rSelection
);
83 void implEnableWindows();
85 void implInitialize(const OUString
& _rSelection
);
86 void implCommit(OUString
& _rSelection
);
89 class ODBFieldPage
: public OMaybeListSelectionPage
91 std::unique_ptr
<weld::Label
> m_xDescription
;
92 std::unique_ptr
<weld::RadioButton
> m_xStoreYes
;
93 std::unique_ptr
<weld::RadioButton
> m_xStoreNo
;
94 std::unique_ptr
<weld::ComboBox
> m_xStoreWhere
;
97 explicit ODBFieldPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
98 virtual ~ODBFieldPage() override
;
101 void setDescriptionText(const OUString
& rDesc
)
103 m_xDescription
->set_label(rDesc
);
106 // OWizardPage overridables
107 virtual void initializePage() override
;
108 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
111 virtual OUString
& getDBFieldSetting() = 0;
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */