Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / dbpilots / gridwizard.hxx
blob5eb9732bd6fd1b839716989ff63c0914d2fbe736
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_GRIDWIZARD_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GRIDWIZARD_HXX
23 #include "controlwizard.hxx"
24 #include "commonpagesdbp.hxx"
26 using vcl::WizardTypes::WizardState;
27 using vcl::WizardTypes::CommitPageReason;
29 namespace dbp
31 struct OGridSettings : public OControlWizardSettings
33 css::uno::Sequence< OUString > aSelectedFields;
36 class OGridWizard final : public OControlWizard
38 OGridSettings m_aSettings;
39 bool m_bHadDataSelection : 1;
41 public:
42 OGridWizard(weld::Window* _pParent,
43 const css::uno::Reference< css::beans::XPropertySet >& _rxObjectModel,
44 const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
46 OGridSettings& getSettings() { return m_aSettings; }
48 private:
49 // OWizardMachine overridables
50 virtual std::unique_ptr<BuilderPage> createPage( WizardState _nState ) override;
51 virtual WizardState determineNextState( WizardState _nCurrentState ) const override;
52 virtual void enterState( WizardState _nState ) override;
53 virtual bool leaveState( WizardState _nState ) override;
54 virtual bool onFinish() override;
56 virtual bool approveControl(sal_Int16 _nClassId) override;
58 void implApplySettings();
61 class OGridPage : public OControlWizardPage
63 public:
64 OGridPage(weld::Container* pPage, OGridWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID)
65 : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID)
68 protected:
69 OGridSettings& getSettings() { return static_cast<OGridWizard*>(getDialog())->getSettings(); }
72 class OGridFieldsSelection final : public OGridPage
74 std::unique_ptr<weld::TreeView> m_xExistFields;
75 std::unique_ptr<weld::Button> m_xSelectOne;
76 std::unique_ptr<weld::Button> m_xSelectAll;
77 std::unique_ptr<weld::Button> m_xDeselectOne;
78 std::unique_ptr<weld::Button> m_xDeselectAll;
79 std::unique_ptr<weld::TreeView> m_xSelFields;
81 public:
82 explicit OGridFieldsSelection(weld::Container* pPage, OGridWizard* pWizard);
83 virtual ~OGridFieldsSelection() override;
85 private:
86 // BuilderPage overridables
87 virtual void Activate() override;
89 // OWizardPage overridables
90 virtual void initializePage() override;
91 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
92 virtual bool canAdvance() const override;
94 DECL_LINK(OnMoveOneEntry, weld::Button&, void);
95 DECL_LINK(OnMoveAllEntries, weld::Button&, void);
96 DECL_LINK(OnEntrySelected, weld::TreeView&, void);
97 DECL_LINK(OnEntryDoubleClicked, weld::TreeView&, bool);
99 void implCheckButtons();
101 } // namespace dbp
104 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GRIDWIZARD_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */