merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / dbpilots / listcombowizard.hxx
blob05f7f70ea65d46ae6b1f05c0411df8cf7ab98869
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
29 #define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
31 #include "controlwizard.hxx"
32 #include "commonpagesdbp.hxx"
34 //.........................................................................
35 namespace dbp
37 //.........................................................................
39 #define LCW_STATE_DATASOURCE_SELECTION 0
40 #define LCW_STATE_TABLESELECTION 1
41 #define LCW_STATE_FIELDSELECTION 2
42 #define LCW_STATE_FIELDLINK 3
43 #define LCW_STATE_COMBODBFIELD 4
45 //=====================================================================
46 //= OListComboSettings
47 //=====================================================================
48 struct OListComboSettings : public OControlWizardSettings
50 String sListContentTable;
51 String sListContentField;
52 String sLinkedFormField;
53 String sLinkedListField;
56 //=====================================================================
57 //= OListComboWizard
58 //=====================================================================
59 class OListComboWizard : public OControlWizard
61 protected:
62 OListComboSettings m_aSettings;
63 sal_Bool m_bListBox : 1;
64 sal_Bool m_bHadDataSelection : 1;
66 public:
67 OListComboWizard(
68 Window* _pParent,
69 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
70 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
73 OListComboSettings& getSettings() { return m_aSettings; }
75 sal_Bool isListBox() const { return m_bListBox; }
77 protected:
78 // OWizardMachine overridables
79 virtual ::svt::OWizardPage* createPage( WizardState _nState );
80 virtual WizardState determineNextState( WizardState _nCurrentState ) const;
81 virtual void enterState( WizardState _nState );
82 virtual sal_Bool leaveState( WizardState _nState );
83 virtual sal_Bool onFinish();
85 virtual sal_Bool approveControl(sal_Int16 _nClassId);
87 WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; }
89 private:
90 void implApplySettings();
93 //=====================================================================
94 //= OLCPage
95 //=====================================================================
96 class OLCPage : public OControlWizardPage
98 public:
99 OLCPage( OListComboWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { }
101 protected:
102 OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
103 sal_Bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); }
105 protected:
106 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
107 getTables(sal_Bool _bNeedIt);
108 ::com::sun::star::uno::Sequence< ::rtl::OUString >
109 getTableFields(sal_Bool _bNeedIt);
112 //=====================================================================
113 //= OContentTableSelection
114 //=====================================================================
115 class OContentTableSelection : public OLCPage
117 protected:
118 FixedLine m_aFrame;
119 FixedText m_aSelectTableLabel;
120 ListBox m_aSelectTable;
122 public:
123 OContentTableSelection( OListComboWizard* _pParent );
125 protected:
126 // TabPage overridables
127 virtual void ActivatePage();
129 // OWizardPage overridables
130 virtual void initializePage();
131 virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
132 virtual bool canAdvance() const;
134 protected:
135 DECL_LINK( OnTableDoubleClicked, ListBox* );
136 DECL_LINK( OnTableSelected, ListBox* );
139 //=====================================================================
140 //= OContentFieldSelection
141 //=====================================================================
142 class OContentFieldSelection : public OLCPage
144 protected:
145 FixedLine m_aFrame;
146 FixedText m_aTableFields;
147 ListBox m_aSelectTableField;
148 FixedText m_aDisplayedFieldLabel;
149 Edit m_aDisplayedField;
150 FixedText m_aInfo;
153 public:
154 OContentFieldSelection( OListComboWizard* _pParent );
156 protected:
157 DECL_LINK( OnFieldSelected, ListBox* );
158 DECL_LINK( OnTableDoubleClicked, ListBox* );
160 // TabPage overridables
161 virtual void ActivatePage();
163 // OWizardPage overridables
164 virtual void initializePage();
165 virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
166 virtual bool canAdvance() const;
169 //=====================================================================
170 //= OLinkFieldsPage
171 //=====================================================================
172 class OLinkFieldsPage : public OLCPage
174 protected:
175 FixedText m_aDescription;
176 FixedLine m_aFrame;
177 FixedText m_aValueListFieldLabel;
178 ComboBox m_aValueListField;
179 FixedText m_aTableFieldLabel;
180 ComboBox m_aTableField;
183 public:
184 OLinkFieldsPage( OListComboWizard* _pParent );
186 protected:
187 // TabPage overridables
188 virtual void ActivatePage();
190 // OWizardPage overridables
191 virtual void initializePage();
192 virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
193 virtual bool canAdvance() const;
195 private:
196 void implCheckFinish();
198 DECL_LINK(OnSelectionModified, void*);
201 //=====================================================================
202 //= OComboDBFieldPage
203 //=====================================================================
204 class OComboDBFieldPage : public ODBFieldPage
206 public:
207 OComboDBFieldPage( OControlWizard* _pParent );
209 protected:
210 OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
212 // TabPage overridables
213 virtual void ActivatePage();
215 // OWizardPage overridables
216 virtual bool canAdvance() const;
218 // ODBFieldPage overridables
219 virtual String& getDBFieldSetting();
222 //.........................................................................
223 } // namespace dbp
224 //.........................................................................
226 #endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_