bump product version to 6.3.0.0.beta1
[LibreOffice.git] / extensions / source / dbpilots / controlwizard.hxx
blobed1729bf07cb66457156fb1a5a98484d39832aad
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_CONTROLWIZARD_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
23 #include <svtools/wizardmachine.hxx>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/form/FormComponentType.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <com/sun/star/task/XInteractionHandler.hpp>
28 #include <vcl/fixed.hxx>
29 #include <vcl/edit.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/lstbox.hxx>
32 #include <vcl/combobox.hxx>
33 #include <vcl/weld.hxx>
34 #include "dbptypes.hxx"
35 #include <strings.hrc>
36 #include <componentmodule.hxx>
37 #include "wizardcontext.hxx"
39 class ResId;
41 namespace dbp
43 struct OControlWizardSettings
45 OUString sControlLabel;
48 class OControlWizard;
49 typedef ::svt::OWizardPage OControlWizardPage_Base;
50 class OControlWizardPage : public OControlWizardPage_Base
52 VclPtr<FixedText> m_pFormDatasourceLabel;
53 VclPtr<FixedText> m_pFormDatasource;
54 VclPtr<FixedText> m_pFormContentTypeLabel;
55 VclPtr<FixedText> m_pFormContentType;
56 VclPtr<FixedText> m_pFormTableLabel;
57 VclPtr<FixedText> m_pFormTable;
59 protected:
60 OControlWizard* getDialog();
61 const OControlWizard* getDialog() const;
62 const OControlWizardContext& getContext();
63 bool updateContext();
64 void setFormConnection(const css::uno::Reference< css::sdbc::XConnection >& _rxConn, bool _bAutoDispose = true );
65 css::uno::Reference< css::sdbc::XConnection >
66 getFormConnection() const;
67 public:
68 OControlWizardPage( OControlWizard* _pParent, const OString& rID, const OUString& rUIXMLDescription );
69 virtual ~OControlWizardPage() override;
70 virtual void dispose() override;
72 protected:
73 static void fillListBox(
74 ListBox& _rList,
75 const css::uno::Sequence< OUString >& _rItems);
76 static void fillListBox(
77 ComboBox& _rList,
78 const css::uno::Sequence< OUString >& _rItems);
80 protected:
81 void enableFormDatasourceDisplay();
83 protected:
84 // OWizardPage overridables
85 virtual void initializePage() override;
88 struct OAccessRegulator;
90 typedef ::svt::OWizardMachine OControlWizard_Base;
91 class OControlWizard : public OControlWizard_Base
93 private:
94 OControlWizardContext m_aContext;
95 css::uno::Reference< css::uno::XComponentContext >
96 m_xContext;
98 public:
99 OControlWizard(
100 vcl::Window* _pParent,
101 const css::uno::Reference< css::beans::XPropertySet >& _rxObjectModel,
102 const css::uno::Reference< css::uno::XComponentContext >& _rxContext
104 virtual ~OControlWizard() override;
106 // make the same base class methods public
107 using OControlWizard_Base::travelNext;
109 public:
110 const css::uno::Reference< css::uno::XComponentContext >&
111 getComponentContext() const { return m_xContext; }
113 const OControlWizardContext& getContext() const { return m_aContext; }
114 bool updateContext(const OAccessRegulator&);
115 void setFormConnection(const OAccessRegulator&, const css::uno::Reference< css::sdbc::XConnection >& _rxConn, bool _bAutoDispose );
116 css::uno::Reference< css::sdbc::XConnection >
117 getFormConnection(const OAccessRegulator&) const;
119 /** returns the com.sun.star.task.InteractionHandler
120 @param _pWindow The window will be used when an error message has to be shown.
122 css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler(weld::Window* _pWindow) const;
124 protected:
125 // initialize the derivees settings (which have to be derived from OControlWizardSettings)
126 // with some common data extracted from the control model
127 void initControlSettings(OControlWizardSettings* _pSettings);
128 // commit the control-relevant settings
129 void commitControlSettings(OControlWizardSettings const * _pSettings);
131 bool needDatasourceSelection();
133 css::uno::Reference< css::sdbc::XConnection >
134 getFormConnection() const;
136 virtual bool approveControl(sal_Int16 _nClassId) = 0;
138 // ModalDialog overridables
139 virtual short Execute() override;
141 private:
142 bool initContext();
144 void implGetDSContext();
145 void implDetermineForm();
146 void implDeterminePage();
147 void implDetermineShape();
149 // made private. Not to be used by derived (or external) classes
150 using OControlWizard_Base::ActivatePage;
154 } // namespace dbp
157 #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */