bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / dbpilots / listcombowizard.hxx
blobaf77d557baed16aa4caaa8e43866c48e1897b34d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX
23 #include "controlwizard.hxx"
24 #include "commonpagesdbp.hxx"
27 namespace dbp
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
37 struct OListComboSettings : public OControlWizardSettings
39 OUString sListContentTable;
40 OUString sListContentField;
41 OUString sLinkedFormField;
42 OUString sLinkedListField;
45 class OListComboWizard final : public OControlWizard
47 OListComboSettings m_aSettings;
48 bool m_bListBox : 1;
49 bool m_bHadDataSelection : 1;
51 public:
52 OListComboWizard(
53 vcl::Window* _pParent,
54 const css::uno::Reference< css::beans::XPropertySet >& _rxObjectModel,
55 const css::uno::Reference< css::uno::XComponentContext >& _rxContext
58 OListComboSettings& getSettings() { return m_aSettings; }
60 bool isListBox() const { return m_bListBox; }
62 private:
63 // OWizardMachine overridables
64 virtual VclPtr<TabPage> createPage( WizardState _nState ) override;
65 virtual WizardState determineNextState( WizardState _nCurrentState ) const override;
66 virtual void enterState( WizardState _nState ) override;
67 virtual bool leaveState( WizardState _nState ) override;
68 virtual bool onFinish() override;
70 virtual bool approveControl(sal_Int16 _nClassId) override;
72 WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; }
74 void implApplySettings();
77 class OLCPage : public OControlWizardPage
79 public:
80 OLCPage(OListComboWizard* _pParent, const OString& rID, const OUString& rUIXMLDescription)
81 : OControlWizardPage(_pParent, rID, rUIXMLDescription)
85 protected:
86 OListComboSettings& getSettings() { return static_cast<OListComboWizard*>(getDialog())->getSettings(); }
87 bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); }
89 protected:
90 css::uno::Reference< css::container::XNameAccess > getTables();
91 css::uno::Sequence< OUString > getTableFields();
94 class OContentTableSelection final : public OLCPage
96 VclPtr<ListBox> m_pSelectTable;
98 public:
99 explicit OContentTableSelection( OListComboWizard* _pParent );
100 virtual ~OContentTableSelection() override;
101 virtual void dispose() override;
103 private:
104 // TabPage overridables
105 virtual void ActivatePage() override;
107 // OWizardPage overridables
108 virtual void initializePage() override;
109 virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) override;
110 virtual bool canAdvance() const override;
112 DECL_LINK( OnTableDoubleClicked, ListBox&, void );
113 DECL_LINK( OnTableSelected, ListBox&, void );
116 class OContentFieldSelection final : public OLCPage
118 VclPtr<ListBox> m_pSelectTableField;
119 VclPtr<Edit> m_pDisplayedField;
120 VclPtr<FixedText> m_pInfo;
123 public:
124 explicit OContentFieldSelection( OListComboWizard* _pParent );
125 virtual ~OContentFieldSelection() override;
126 virtual void dispose() override;
128 private:
129 DECL_LINK( OnFieldSelected, ListBox&, void );
130 DECL_LINK( OnTableDoubleClicked, ListBox&, void );
132 // OWizardPage overridables
133 virtual void initializePage() override;
134 virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) override;
135 virtual bool canAdvance() const override;
138 class OLinkFieldsPage final : public OLCPage
140 VclPtr<ComboBox> m_pValueListField;
141 VclPtr<ComboBox> m_pTableField;
144 public:
145 explicit OLinkFieldsPage( OListComboWizard* _pParent );
146 virtual ~OLinkFieldsPage() override;
147 virtual void dispose() override;
149 private:
150 // TabPage overridables
151 virtual void ActivatePage() override;
153 // OWizardPage overridables
154 virtual void initializePage() override;
155 virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) override;
156 virtual bool canAdvance() const override;
158 void implCheckFinish();
160 DECL_LINK(OnSelectionModified, Edit&, void);
161 DECL_LINK(OnSelectionModifiedCombBox, ComboBox&, void);
164 class OComboDBFieldPage : public ODBFieldPage
166 public:
167 explicit OComboDBFieldPage( OControlWizard* _pParent );
169 protected:
170 // TabPage overridables
171 virtual void ActivatePage() override;
173 // OWizardPage overridables
174 virtual bool canAdvance() const override;
176 // ODBFieldPage overridables
177 virtual OUString& getDBFieldSetting() override;
181 } // namespace dbp
184 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */