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
;
30 struct OGridSettings
: public OControlWizardSettings
32 css::uno::Sequence
< OUString
> aSelectedFields
;
35 class OGridWizard final
: public OControlWizard
37 OGridSettings m_aSettings
;
38 bool m_bHadDataSelection
: 1;
41 OGridWizard(weld::Window
* _pParent
,
42 const css::uno::Reference
< css::beans::XPropertySet
>& _rxObjectModel
,
43 const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
);
45 OGridSettings
& getSettings() { return m_aSettings
; }
48 // OWizardMachine overridables
49 virtual std::unique_ptr
<BuilderPage
> createPage( WizardState _nState
) override
;
50 virtual WizardState
determineNextState( WizardState _nCurrentState
) const override
;
51 virtual void enterState( WizardState _nState
) override
;
52 virtual bool leaveState( WizardState _nState
) override
;
53 virtual bool onFinish() override
;
55 virtual bool approveControl(sal_Int16 _nClassId
) override
;
57 void implApplySettings();
60 class OGridPage
: public OControlWizardPage
63 OGridPage(weld::Container
* pPage
, OGridWizard
* pWizard
, const OUString
& rUIXMLDescription
, const OUString
& rID
)
64 : OControlWizardPage(pPage
, pWizard
, rUIXMLDescription
, rID
)
68 OGridSettings
& getSettings() { return static_cast<OGridWizard
*>(getDialog())->getSettings(); }
71 class OGridFieldsSelection final
: public OGridPage
73 std::unique_ptr
<weld::TreeView
> m_xExistFields
;
74 std::unique_ptr
<weld::Button
> m_xSelectOne
;
75 std::unique_ptr
<weld::Button
> m_xSelectAll
;
76 std::unique_ptr
<weld::Button
> m_xDeselectOne
;
77 std::unique_ptr
<weld::Button
> m_xDeselectAll
;
78 std::unique_ptr
<weld::TreeView
> m_xSelFields
;
81 explicit OGridFieldsSelection(weld::Container
* pPage
, OGridWizard
* pWizard
);
82 virtual ~OGridFieldsSelection() override
;
85 // BuilderPage overridables
86 virtual void Activate() override
;
88 // OWizardPage overridables
89 virtual void initializePage() override
;
90 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
91 virtual bool canAdvance() const override
;
93 DECL_LINK(OnMoveOneEntry
, weld::Button
&, void);
94 DECL_LINK(OnMoveAllEntries
, weld::Button
&, void);
95 DECL_LINK(OnEntrySelected
, weld::TreeView
&, void);
96 DECL_LINK(OnEntryDoubleClicked
, weld::TreeView
&, bool);
98 void implCheckButtons();
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */