1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: listcombowizard.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
32 #define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_
34 #include "controlwizard.hxx"
35 #include "commonpagesdbp.hxx"
37 //.........................................................................
40 //.........................................................................
42 #define LCW_STATE_DATASOURCE_SELECTION 0
43 #define LCW_STATE_TABLESELECTION 1
44 #define LCW_STATE_FIELDSELECTION 2
45 #define LCW_STATE_FIELDLINK 3
46 #define LCW_STATE_COMBODBFIELD 4
48 //=====================================================================
49 //= OListComboSettings
50 //=====================================================================
51 struct OListComboSettings
: public OControlWizardSettings
53 String sListContentTable
;
54 String sListContentField
;
55 String sLinkedFormField
;
56 String sLinkedListField
;
59 //=====================================================================
61 //=====================================================================
62 class OListComboWizard
: public OControlWizard
65 OListComboSettings m_aSettings
;
66 sal_Bool m_bListBox
: 1;
67 sal_Bool m_bHadDataSelection
: 1;
72 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxObjectModel
,
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
76 OListComboSettings
& getSettings() { return m_aSettings
; }
78 sal_Bool
isListBox() const { return m_bListBox
; }
81 // OWizardMachine overridables
82 virtual ::svt::OWizardPage
* createPage( WizardState _nState
);
83 virtual WizardState
determineNextState( WizardState _nCurrentState
) const;
84 virtual void enterState( WizardState _nState
);
85 virtual sal_Bool
leaveState( WizardState _nState
);
87 virtual sal_Bool
onFinish(sal_Int32 _nResult
);
89 virtual sal_Bool
approveControl(sal_Int16 _nClassId
);
91 WizardState
getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK
: LCW_STATE_COMBODBFIELD
; }
94 void implApplySettings();
97 //=====================================================================
99 //=====================================================================
100 class OLCPage
: public OControlWizardPage
103 OLCPage( OListComboWizard
* _pParent
, const ResId
& _rId
) : OControlWizardPage(_pParent
, _rId
) { }
106 OListComboSettings
& getSettings() { return static_cast<OListComboWizard
*>(getDialog())->getSettings(); }
107 sal_Bool
isListBox() { return static_cast<OListComboWizard
*>(getDialog())->isListBox(); }
110 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
111 getTables(sal_Bool _bNeedIt
);
112 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
113 getTableFields(sal_Bool _bNeedIt
);
116 //=====================================================================
117 //= OContentTableSelection
118 //=====================================================================
119 class OContentTableSelection
: public OLCPage
123 FixedText m_aSelectTableLabel
;
124 ListBox m_aSelectTable
;
127 OContentTableSelection( OListComboWizard
* _pParent
);
130 // TabPage overridables
131 virtual void ActivatePage();
133 // OWizardPage overridables
134 virtual void initializePage();
135 virtual sal_Bool
commitPage( CommitPageReason _eReason
);
136 virtual bool canAdvance() const;
139 DECL_LINK( OnTableDoubleClicked
, ListBox
* );
140 DECL_LINK( OnTableSelected
, ListBox
* );
143 //=====================================================================
144 //= OContentFieldSelection
145 //=====================================================================
146 class OContentFieldSelection
: public OLCPage
150 FixedText m_aTableFields
;
151 ListBox m_aSelectTableField
;
152 FixedText m_aDisplayedFieldLabel
;
153 Edit m_aDisplayedField
;
158 OContentFieldSelection( OListComboWizard
* _pParent
);
161 DECL_LINK( OnFieldSelected
, ListBox
* );
162 DECL_LINK( OnTableDoubleClicked
, ListBox
* );
164 // TabPage overridables
165 virtual void ActivatePage();
167 // OWizardPage overridables
168 virtual void initializePage();
169 virtual sal_Bool
commitPage( CommitPageReason _eReason
);
170 virtual bool canAdvance() const;
173 //=====================================================================
175 //=====================================================================
176 class OLinkFieldsPage
: public OLCPage
179 FixedText m_aDescription
;
181 FixedText m_aValueListFieldLabel
;
182 ComboBox m_aValueListField
;
183 FixedText m_aTableFieldLabel
;
184 ComboBox m_aTableField
;
188 OLinkFieldsPage( OListComboWizard
* _pParent
);
191 // TabPage overridables
192 virtual void ActivatePage();
194 // OWizardPage overridables
195 virtual void initializePage();
196 virtual sal_Bool
commitPage( CommitPageReason _eReason
);
197 virtual bool canAdvance() const;
200 void implCheckFinish();
202 DECL_LINK(OnSelectionModified
, void*);
205 //=====================================================================
206 //= OComboDBFieldPage
207 //=====================================================================
208 class OComboDBFieldPage
: public ODBFieldPage
211 OComboDBFieldPage( OControlWizard
* _pParent
);
214 OListComboSettings
& getSettings() { return static_cast<OListComboWizard
*>(getDialog())->getSettings(); }
216 // TabPage overridables
217 virtual void ActivatePage();
219 // OWizardPage overridables
220 virtual bool canAdvance() const;
222 // ODBFieldPage overridables
223 virtual String
& getDBFieldSetting();
226 //.........................................................................
228 //.........................................................................
230 #endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_