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 INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_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 : class OTableSelectionPage : public OControlWizardPage
33 : {
34 : protected:
35 : VclPtr<FixedText> m_pDatasourceLabel;
36 : VclPtr<ListBox> m_pDatasource;
37 : VclPtr<PushButton> m_pSearchDatabase;
38 : VclPtr<ListBox> m_pTable;
39 :
40 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
41 : m_xDSContext;
42 :
43 : public:
44 : OTableSelectionPage(OControlWizard* _pParent);
45 : virtual ~OTableSelectionPage();
46 : virtual void dispose() SAL_OVERRIDE;
47 :
48 : protected:
49 : // TabPage overridables
50 : void ActivatePage() SAL_OVERRIDE;
51 :
52 : // OWizardPage overridables
53 : virtual void initializePage() SAL_OVERRIDE;
54 : virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) SAL_OVERRIDE;
55 :
56 : protected:
57 : DECL_LINK( OnListboxSelection, ListBox* );
58 : DECL_LINK( OnListboxDoubleClicked, ListBox* );
59 : DECL_LINK( OnSearchClicked, PushButton* );
60 :
61 : void implCollectDatasource();
62 : void implFillTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
63 : _rxConn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >());
64 :
65 : // OControlWizardPage overridables
66 : virtual bool canAdvance() const SAL_OVERRIDE;
67 : };
68 :
69 : class OMaybeListSelectionPage : public OControlWizardPage
70 : {
71 : protected:
72 : VclPtr<RadioButton> m_pYes;
73 : VclPtr<RadioButton> m_pNo;
74 : VclPtr<ListBox> m_pList;
75 :
76 : public:
77 : OMaybeListSelectionPage( OControlWizard* _pParent, const OString& _rID, const OUString& _rUIXMLDescription );
78 : virtual ~OMaybeListSelectionPage();
79 : virtual void dispose() SAL_OVERRIDE;
80 :
81 : protected:
82 : DECL_LINK( OnRadioSelected, RadioButton* );
83 :
84 : // TabPage overridables
85 : void ActivatePage() SAL_OVERRIDE;
86 :
87 : // own helper
88 : void announceControls(
89 : RadioButton& _rYesButton,
90 : RadioButton& _rNoButton,
91 : ListBox& _rSelection);
92 :
93 : void implEnableWindows();
94 :
95 : void implInitialize(const OUString& _rSelection);
96 : void implCommit(OUString& _rSelection);
97 : };
98 :
99 : class ODBFieldPage : public OMaybeListSelectionPage
100 : {
101 : protected:
102 : VclPtr<FixedText> m_pDescription;
103 : VclPtr<RadioButton> m_pStoreYes;
104 : VclPtr<RadioButton> m_pStoreNo;
105 : VclPtr<ListBox> m_pStoreWhere;
106 :
107 : public:
108 : ODBFieldPage( OControlWizard* _pParent );
109 : virtual ~ODBFieldPage();
110 : virtual void dispose() SAL_OVERRIDE;
111 :
112 : protected:
113 0 : void setDescriptionText(const OUString& _rDesc) { m_pDescription->SetText(_rDesc); }
114 :
115 : // OWizardPage overridables
116 : virtual void initializePage() SAL_OVERRIDE;
117 : virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) SAL_OVERRIDE;
118 :
119 : // own overridables
120 : virtual OUString& getDBFieldSetting() = 0;
121 : };
122 :
123 :
124 : } // namespace dbp
125 :
126 :
127 :
128 : #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|