LibreOffice Module extensions (master) 1
listcombowizard.hxx
Go to the documentation of this file.
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#pragma once
21
22#include "controlwizard.hxx"
23#include "commonpagesdbp.hxx"
24
27
28namespace dbp
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
38 {
43 };
44
45 class OListComboWizard final : public OControlWizard
46 {
48 bool m_bListBox : 1;
50
51 public:
53 weld::Window* pParent,
54 const css::uno::Reference< css::beans::XPropertySet >& _rxObjectModel,
55 const css::uno::Reference< css::uno::XComponentContext >& _rxContext
56 );
57
59
60 bool isListBox() const { return m_bListBox; }
61
62 private:
63 // OWizardMachine overridables
64 virtual std::unique_ptr<BuilderPage> 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;
69
70 virtual bool approveControl(sal_Int16 _nClassId) override;
71
73
74 void implApplySettings();
75 };
76
78 {
79 public:
80 OLCPage(weld::Container* pPage, OListComboWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID)
81 : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID)
82 {
83 }
84
85 protected:
87 bool isListBox() { return static_cast<OListComboWizard*>(getDialog())->isListBox(); }
88
89 protected:
90 css::uno::Reference< css::container::XNameAccess > getTables() const;
91 css::uno::Sequence< OUString > getTableFields();
92 };
93
94 class OContentTableSelection final : public OLCPage
95 {
96 std::unique_ptr<weld::TreeView> m_xSelectTable;
97
98 public:
100 virtual ~OContentTableSelection() override;
101
102 private:
103 // BuilderPage overridables
104 virtual void Activate() override;
105
106 // OWizardPage overridables
107 virtual void initializePage() override;
108 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
109 virtual bool canAdvance() const override;
110
111 DECL_LINK( OnTableDoubleClicked, weld::TreeView&, bool );
112 DECL_LINK( OnTableSelected, weld::TreeView&, void );
113 };
114
115 class OContentFieldSelection final : public OLCPage
116 {
117 std::unique_ptr<weld::TreeView> m_xSelectTableField;
118 std::unique_ptr<weld::Entry> m_xDisplayedField;
119 std::unique_ptr<weld::Label> m_xInfo;
120
121 public:
123 virtual ~OContentFieldSelection() override;
124
125 private:
126 DECL_LINK( OnFieldSelected, weld::TreeView&, void );
127 DECL_LINK( OnTableDoubleClicked, weld::TreeView&, bool );
128
129 // OWizardPage overridables
130 virtual void initializePage() override;
131 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
132 virtual bool canAdvance() const override;
133 };
134
135 class OLinkFieldsPage final : public OLCPage
136 {
137 std::unique_ptr<weld::ComboBox> m_xValueListField;
138 std::unique_ptr<weld::ComboBox> m_xTableField;
139
140 public:
141 explicit OLinkFieldsPage(weld::Container* pPage, OListComboWizard* pWizard);
142 virtual ~OLinkFieldsPage() override;
143
144 private:
145 // BuilderPage overridables
146 virtual void Activate() override;
147
148 // OWizardPage overridables
149 virtual void initializePage() override;
150 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
151 virtual bool canAdvance() const override;
152
153 void implCheckFinish();
154
155 DECL_LINK(OnSelectionModified, weld::ComboBox&, void);
156 };
157
159 {
160 public:
161 explicit OComboDBFieldPage(weld::Container* pPage, OControlWizard* pWizard);
162
163 protected:
164 // BuilderPage overridables
165 virtual void Activate() override;
166
167 // OWizardPage overridables
168 virtual bool canAdvance() const override;
169
170 // ODBFieldPage overridables
171 virtual OUString& getDBFieldSetting() override;
172 };
173
174
175} // namespace dbp
176
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString & getDBFieldSetting() override
virtual bool canAdvance() const override
virtual void Activate() override
OComboDBFieldPage(weld::Container *pPage, OControlWizard *pWizard)
DECL_LINK(OnFieldSelected, weld::TreeView &, void)
std::unique_ptr< weld::Label > m_xInfo
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
DECL_LINK(OnTableDoubleClicked, weld::TreeView &, bool)
std::unique_ptr< weld::TreeView > m_xSelectTableField
virtual void initializePage() override
OContentFieldSelection(weld::Container *pPage, OListComboWizard *pWizard)
virtual bool canAdvance() const override
std::unique_ptr< weld::Entry > m_xDisplayedField
virtual ~OContentFieldSelection() override
virtual void Activate() override
virtual bool canAdvance() const override
virtual void initializePage() override
DECL_LINK(OnTableSelected, weld::TreeView &, void)
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
DECL_LINK(OnTableDoubleClicked, weld::TreeView &, bool)
OContentTableSelection(weld::Container *pPage, OListComboWizard *pWizard)
virtual ~OContentTableSelection() override
std::unique_ptr< weld::TreeView > m_xSelectTable
OControlWizard * getDialog()
css::uno::Reference< css::container::XNameAccess > getTables() const
OLCPage(weld::Container *pPage, OListComboWizard *pWizard, const OUString &rUIXMLDescription, const OUString &rID)
OListComboSettings & getSettings()
css::uno::Sequence< OUString > getTableFields()
virtual bool canAdvance() const override
virtual void initializePage() override
std::unique_ptr< weld::ComboBox > m_xTableField
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
OLinkFieldsPage(weld::Container *pPage, OListComboWizard *pWizard)
virtual ~OLinkFieldsPage() override
std::unique_ptr< weld::ComboBox > m_xValueListField
virtual void Activate() override
DECL_LINK(OnSelectionModified, weld::ComboBox &, void)
virtual bool approveControl(sal_Int16 _nClassId) override
OListComboSettings m_aSettings
virtual bool onFinish() override
virtual void enterState(WizardState _nState) override
virtual bool leaveState(WizardState _nState) override
OListComboWizard(weld::Window *pParent, const css::uno::Reference< css::beans::XPropertySet > &_rxObjectModel, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
virtual WizardState determineNextState(WizardState _nCurrentState) const override
WizardState getFinalState() const
virtual std::unique_ptr< BuilderPage > createPage(WizardState _nState) override
OListComboSettings & getSettings()
#define LCW_STATE_COMBODBFIELD
#define LCW_STATE_FIELDLINK
sal_Int16 WizardState