1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include "controlwizard.hxx"
23 #include "commonpagesdbp.hxx"
25 using vcl::WizardTypes::WizardState
;
26 using vcl::WizardTypes::CommitPageReason
;
31 struct OOptionGroupSettings
: public OControlWizardSettings
33 std::vector
<OUString
> aLabels
;
34 std::vector
<OUString
> aValues
;
35 OUString sDefaultField
;
39 class OGroupBoxWizard final
: public OControlWizard
41 OOptionGroupSettings m_aSettings
;
43 bool m_bVisitedDefault
: 1;
44 bool m_bVisitedDB
: 1;
48 weld::Window
* _pParent
,
49 const css::uno::Reference
< css::beans::XPropertySet
>& _rxObjectModel
,
50 const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
53 OOptionGroupSettings
& getSettings() { return m_aSettings
; }
56 // OWizardMachine overridables
57 virtual std::unique_ptr
<BuilderPage
> createPage( WizardState _nState
) override
;
58 virtual WizardState
determineNextState( WizardState _nCurrentState
) const override
;
59 virtual void enterState( WizardState _nState
) override
;
60 virtual bool onFinish() override
;
62 virtual bool approveControl(sal_Int16 _nClassId
) override
;
65 class OGBWPage
: public OControlWizardPage
68 OGBWPage(weld::Container
* pPage
, OControlWizard
* pWizard
, const OUString
& rUIXMLDescription
, const OUString
& rID
)
69 : OControlWizardPage(pPage
, pWizard
, rUIXMLDescription
, rID
)
74 OOptionGroupSettings
& getSettings() { return static_cast<OGroupBoxWizard
*>(getDialog())->getSettings(); }
77 class ORadioSelectionPage final
: public OGBWPage
79 std::unique_ptr
<weld::Entry
> m_xRadioName
;
80 std::unique_ptr
<weld::Button
> m_xMoveRight
;
81 std::unique_ptr
<weld::Button
> m_xMoveLeft
;
82 std::unique_ptr
<weld::TreeView
> m_xExistingRadios
;
85 explicit ORadioSelectionPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
86 virtual ~ORadioSelectionPage() override
;
89 // BuilderPage overridables
90 void Activate() override
;
92 // OWizardPage overridables
93 virtual void initializePage() override
;
94 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
95 virtual bool canAdvance() const override
;
97 DECL_LINK( OnMoveEntry
, weld::Button
&, void );
98 DECL_LINK( OnEntrySelected
, weld::TreeView
&, void );
99 DECL_LINK( OnNameModified
, weld::Entry
&, void );
101 void implCheckMoveButtons();
104 class ODefaultFieldSelectionPage final
: public OMaybeListSelectionPage
106 std::unique_ptr
<weld::RadioButton
> m_xDefSelYes
;
107 std::unique_ptr
<weld::RadioButton
> m_xDefSelNo
;
108 std::unique_ptr
<weld::ComboBox
> m_xDefSelection
;
111 explicit ODefaultFieldSelectionPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
112 virtual ~ODefaultFieldSelectionPage() override
;
115 // OWizardPage overridables
116 virtual void initializePage() override
;
117 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
119 OOptionGroupSettings
& getSettings() { return static_cast<OGroupBoxWizard
*>(getDialog())->getSettings(); }
122 class OOptionValuesPage final
: public OGBWPage
124 std::unique_ptr
<weld::Entry
> m_xValue
;
125 std::unique_ptr
<weld::TreeView
> m_xOptions
;
127 std::vector
<OUString
> m_aUncommittedValues
;
128 ::vcl::WizardTypes::WizardState
132 explicit OOptionValuesPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
133 virtual ~OOptionValuesPage() override
;
136 // BuilderPage overridables
137 void Activate() override
;
139 // OWizardPage overridables
140 virtual void initializePage() override
;
141 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
143 void implTraveledOptions();
145 DECL_LINK( OnOptionSelected
, weld::TreeView
&, void );
148 class OOptionDBFieldPage
: public ODBFieldPage
151 explicit OOptionDBFieldPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
154 // ODBFieldPage overridables
155 virtual OUString
& getDBFieldSetting() override
;
158 class OFinalizeGBWPage final
: public OGBWPage
160 std::unique_ptr
<weld::Entry
> m_xName
;
163 explicit OFinalizeGBWPage(weld::Container
* pPage
, OControlWizard
* pWizard
);
164 virtual ~OFinalizeGBWPage() override
;
167 // BuilderPage overridables
168 void Activate() override
;
170 // OWizardPage overridables
171 virtual void initializePage() override
;
172 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
173 virtual bool canAdvance() const override
;
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */