Line data Source code
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 : #ifndef _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
21 : #define _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
22 :
23 : #include "controlwizard.hxx"
24 : #include <vcl/fixed.hxx>
25 : #include <vcl/lstbox.hxx>
26 : #include <com/sun/star/sdb/XDatabaseContext.hpp>
27 :
28 :
29 : namespace dbp
30 : {
31 :
32 :
33 :
34 : //= OTableSelectionPage
35 :
36 0 : class OTableSelectionPage : public OControlWizardPage
37 : {
38 : protected:
39 : FixedLine m_aData;
40 : FixedText m_aExplanation;
41 : FixedText m_aDatasourceLabel;
42 : ListBox m_aDatasource;
43 : PushButton m_aSearchDatabase;
44 : FixedText m_aTableLabel;
45 : ListBox m_aTable;
46 :
47 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
48 : m_xDSContext;
49 :
50 : public:
51 : OTableSelectionPage(OControlWizard* _pParent);
52 :
53 : protected:
54 : // TabPage overridables
55 : void ActivatePage() SAL_OVERRIDE;
56 :
57 : // OWizardPage overridables
58 : virtual void initializePage() SAL_OVERRIDE;
59 : virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) SAL_OVERRIDE;
60 :
61 : protected:
62 : DECL_LINK( OnListboxSelection, ListBox* );
63 : DECL_LINK( OnListboxDoubleClicked, ListBox* );
64 : DECL_LINK( OnSearchClicked, PushButton* );
65 :
66 : void implCollectDatasource();
67 : void implFillTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
68 : _rxConn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >());
69 :
70 : // OControlWizardPage overridables
71 : virtual bool canAdvance() const SAL_OVERRIDE;
72 : };
73 :
74 :
75 : //= OMaybeListSelectionPage
76 :
77 0 : class OMaybeListSelectionPage : public OControlWizardPage
78 : {
79 : protected:
80 : RadioButton* m_pYes;
81 : RadioButton* m_pNo;
82 : ListBox* m_pList;
83 :
84 : public:
85 : OMaybeListSelectionPage( OControlWizard* _pParent, const ResId& _rId );
86 :
87 : protected:
88 : DECL_LINK( OnRadioSelected, RadioButton* );
89 :
90 : // TabPage overridables
91 : void ActivatePage() SAL_OVERRIDE;
92 :
93 : // own helper
94 : void announceControls(
95 : RadioButton& _rYesButton,
96 : RadioButton& _rNoButton,
97 : ListBox& _rSelection);
98 :
99 : void implEnableWindows();
100 :
101 : void implInitialize(const OUString& _rSelection);
102 : void implCommit(OUString& _rSelection);
103 : };
104 :
105 :
106 : //= ODBFieldPage
107 :
108 0 : class ODBFieldPage : public OMaybeListSelectionPage
109 : {
110 : protected:
111 : FixedLine m_aFrame;
112 : FixedText m_aDescription;
113 : FixedText m_aQuestion;
114 : RadioButton m_aStoreYes;
115 : RadioButton m_aStoreNo;
116 : ListBox m_aStoreWhere;
117 :
118 : public:
119 : ODBFieldPage( OControlWizard* _pParent );
120 :
121 : protected:
122 0 : void setDescriptionText(const OUString& _rDesc) { m_aDescription.SetText(_rDesc); }
123 :
124 : // OWizardPage overridables
125 : virtual void initializePage() SAL_OVERRIDE;
126 : virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) SAL_OVERRIDE;
127 :
128 : // own overridables
129 : virtual OUString& getDBFieldSetting() = 0;
130 : };
131 :
132 :
133 : } // namespace dbp
134 :
135 :
136 :
137 : #endif // _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|