Branch data 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_LISTCOMBOWIZARD_HXX_
21 : : #define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
22 : :
23 : : #include "controlwizard.hxx"
24 : : #include "commonpagesdbp.hxx"
25 : :
26 : : //.........................................................................
27 : : namespace dbp
28 : : {
29 : : //.........................................................................
30 : :
31 : : #define LCW_STATE_DATASOURCE_SELECTION 0
32 : : #define LCW_STATE_TABLESELECTION 1
33 : : #define LCW_STATE_FIELDSELECTION 2
34 : : #define LCW_STATE_FIELDLINK 3
35 : : #define LCW_STATE_COMBODBFIELD 4
36 : :
37 : : //=====================================================================
38 : : //= OListComboSettings
39 : : //=====================================================================
40 : 0 : struct OListComboSettings : public OControlWizardSettings
41 : : {
42 : : String sListContentTable;
43 : : String sListContentField;
44 : : String sLinkedFormField;
45 : : String sLinkedListField;
46 : : };
47 : :
48 : : //=====================================================================
49 : : //= OListComboWizard
50 : : //=====================================================================
51 : 0 : class OListComboWizard : public OControlWizard
52 : : {
53 : : protected:
54 : : OListComboSettings m_aSettings;
55 : : sal_Bool m_bListBox : 1;
56 : : sal_Bool m_bHadDataSelection : 1;
57 : :
58 : : public:
59 : : OListComboWizard(
60 : : Window* _pParent,
61 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
62 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
63 : : );
64 : :
65 : 0 : OListComboSettings& getSettings() { return m_aSettings; }
66 : :
67 : 0 : sal_Bool isListBox() const { return m_bListBox; }
68 : :
69 : : protected:
70 : : // OWizardMachine overridables
71 : : virtual ::svt::OWizardPage* createPage( WizardState _nState );
72 : : virtual WizardState determineNextState( WizardState _nCurrentState ) const;
73 : : virtual void enterState( WizardState _nState );
74 : : virtual sal_Bool leaveState( WizardState _nState );
75 : : virtual sal_Bool onFinish();
76 : :
77 : : virtual sal_Bool approveControl(sal_Int16 _nClassId);
78 : :
79 : 0 : WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; }
80 : :
81 : : private:
82 : : void implApplySettings();
83 : : };
84 : :
85 : : //=====================================================================
86 : : //= OLCPage
87 : : //=====================================================================
88 : 0 : class OLCPage : public OControlWizardPage
89 : : {
90 : : public:
91 : 0 : OLCPage( OListComboWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { }
92 : :
93 : : protected:
94 : 0 : OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
95 : 0 : sal_Bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); }
96 : :
97 : : protected:
98 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
99 : : getTables(sal_Bool _bNeedIt);
100 : : ::com::sun::star::uno::Sequence< ::rtl::OUString >
101 : : getTableFields(sal_Bool _bNeedIt);
102 : : };
103 : :
104 : : //=====================================================================
105 : : //= OContentTableSelection
106 : : //=====================================================================
107 : 0 : class OContentTableSelection : public OLCPage
108 : : {
109 : : protected:
110 : : FixedLine m_aFrame;
111 : : FixedText m_aSelectTableLabel;
112 : : ListBox m_aSelectTable;
113 : :
114 : : public:
115 : : OContentTableSelection( OListComboWizard* _pParent );
116 : :
117 : : protected:
118 : : // TabPage overridables
119 : : virtual void ActivatePage();
120 : :
121 : : // OWizardPage overridables
122 : : virtual void initializePage();
123 : : virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
124 : : virtual bool canAdvance() const;
125 : :
126 : : protected:
127 : : DECL_LINK( OnTableDoubleClicked, ListBox* );
128 : : DECL_LINK( OnTableSelected, ListBox* );
129 : : };
130 : :
131 : : //=====================================================================
132 : : //= OContentFieldSelection
133 : : //=====================================================================
134 : 0 : class OContentFieldSelection : public OLCPage
135 : : {
136 : : protected:
137 : : FixedLine m_aFrame;
138 : : FixedText m_aTableFields;
139 : : ListBox m_aSelectTableField;
140 : : FixedText m_aDisplayedFieldLabel;
141 : : Edit m_aDisplayedField;
142 : : FixedText m_aInfo;
143 : :
144 : :
145 : : public:
146 : : OContentFieldSelection( OListComboWizard* _pParent );
147 : :
148 : : protected:
149 : : DECL_LINK( OnFieldSelected, ListBox* );
150 : : DECL_LINK( OnTableDoubleClicked, ListBox* );
151 : :
152 : : // TabPage overridables
153 : : virtual void ActivatePage();
154 : :
155 : : // OWizardPage overridables
156 : : virtual void initializePage();
157 : : virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
158 : : virtual bool canAdvance() const;
159 : : };
160 : :
161 : : //=====================================================================
162 : : //= OLinkFieldsPage
163 : : //=====================================================================
164 : 0 : class OLinkFieldsPage : public OLCPage
165 : : {
166 : : protected:
167 : : FixedText m_aDescription;
168 : : FixedLine m_aFrame;
169 : : FixedText m_aValueListFieldLabel;
170 : : ComboBox m_aValueListField;
171 : : FixedText m_aTableFieldLabel;
172 : : ComboBox m_aTableField;
173 : :
174 : :
175 : : public:
176 : : OLinkFieldsPage( OListComboWizard* _pParent );
177 : :
178 : : protected:
179 : : // TabPage overridables
180 : : virtual void ActivatePage();
181 : :
182 : : // OWizardPage overridables
183 : : virtual void initializePage();
184 : : virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
185 : : virtual bool canAdvance() const;
186 : :
187 : : private:
188 : : void implCheckFinish();
189 : :
190 : : DECL_LINK(OnSelectionModified, void*);
191 : : };
192 : :
193 : : //=====================================================================
194 : : //= OComboDBFieldPage
195 : : //=====================================================================
196 : 0 : class OComboDBFieldPage : public ODBFieldPage
197 : : {
198 : : public:
199 : : OComboDBFieldPage( OControlWizard* _pParent );
200 : :
201 : : protected:
202 : 0 : OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
203 : :
204 : : // TabPage overridables
205 : : virtual void ActivatePage();
206 : :
207 : : // OWizardPage overridables
208 : : virtual bool canAdvance() const;
209 : :
210 : : // ODBFieldPage overridables
211 : : virtual String& getDBFieldSetting();
212 : : };
213 : :
214 : : //.........................................................................
215 : : } // namespace dbp
216 : : //.........................................................................
217 : :
218 : : #endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
219 : :
220 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|