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 <com/sun/star/lang/XMultiServiceFactory.hpp>
23 #include <com/sun/star/form/FormComponentType.hpp>
24 #include <com/sun/star/sdbc/XConnection.hpp>
25 #include <com/sun/star/task/XInteractionHandler.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <vcl/weld.hxx>
28 #include <vcl/wizardmachine.hxx>
29 #include "dbptypes.hxx"
30 #include <strings.hrc>
31 #include <componentmodule.hxx>
32 #include "wizardcontext.hxx"
38 struct OControlWizardSettings
40 OUString sControlLabel
;
44 typedef ::vcl::OWizardPage OControlWizardPage_Base
;
45 class OControlWizardPage
: public OControlWizardPage_Base
47 OControlWizard
* m_pDialog
;
48 std::unique_ptr
<weld::Label
> m_xFormDatasourceLabel
;
49 std::unique_ptr
<weld::Label
> m_xFormDatasource
;
50 std::unique_ptr
<weld::Label
> m_xFormContentTypeLabel
;
51 std::unique_ptr
<weld::Label
> m_xFormContentType
;
52 std::unique_ptr
<weld::Label
> m_xFormTable
;
53 std::unique_ptr
<weld::Frame
> m_xFrame
;
56 OControlWizard
* getDialog();
57 const OControlWizard
* getDialog() const;
58 const OControlWizardContext
& getContext() const;
60 void setFormConnection(const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
, bool _bAutoDispose
= true );
61 css::uno::Reference
< css::sdbc::XConnection
>
62 getFormConnection() const;
64 OControlWizardPage(weld::Container
* pPage
, OControlWizard
* pWizard
, const OUString
& rUIXMLDescription
, const OUString
& rID
);
65 virtual ~OControlWizardPage() override
;
68 static void fillListBox(
69 weld::TreeView
& _rList
,
70 const css::uno::Sequence
< OUString
>& _rItems
);
71 static void fillListBox(
72 weld::ComboBox
& _rList
,
73 const css::uno::Sequence
< OUString
>& _rItems
);
76 void enableFormDatasourceDisplay();
79 // OWizardPage overridables
80 virtual void initializePage() override
;
83 struct OAccessRegulator
;
85 typedef ::vcl::WizardMachine OControlWizard_Base
;
86 class OControlWizard
: public OControlWizard_Base
89 OControlWizardContext m_aContext
;
90 css::uno::Reference
< css::uno::XComponentContext
>
95 weld::Window
* _pParent
,
96 const css::uno::Reference
< css::beans::XPropertySet
>& _rxObjectModel
,
97 const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
99 virtual ~OControlWizard() override
;
101 // make the same base class methods public
102 using OControlWizard_Base::travelNext
;
105 const css::uno::Reference
< css::uno::XComponentContext
>&
106 getComponentContext() const { return m_xContext
; }
108 const OControlWizardContext
& getContext() const { return m_aContext
; }
109 bool updateContext(const OAccessRegulator
&);
110 void setFormConnection(const OAccessRegulator
&, const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
, bool _bAutoDispose
);
111 css::uno::Reference
< css::sdbc::XConnection
>
112 getFormConnection(const OAccessRegulator
&) const;
114 /** returns the com.sun.star.task.InteractionHandler
115 @param _pWindow The window will be used when an error message has to be shown.
117 css::uno::Reference
< css::task::XInteractionHandler
> getInteractionHandler(weld::Window
* _pWindow
) const;
120 // initialize the derivees settings (which have to be derived from OControlWizardSettings)
121 // with some common data extracted from the control model
122 void initControlSettings(OControlWizardSettings
* _pSettings
);
123 // commit the control-relevant settings
124 void commitControlSettings(OControlWizardSettings
const * _pSettings
);
126 bool needDatasourceSelection();
128 css::uno::Reference
< css::sdbc::XConnection
>
129 getFormConnection() const;
131 virtual bool approveControl(sal_Int16 _nClassId
) = 0;
133 virtual short run() override
;
138 void implGetDSContext();
139 void implDetermineForm();
140 void implDeterminePage();
141 void implDetermineShape();
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */