Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _EXTENSIONS_DBP_CONTROLWIZARD_HXX
21 : #define _EXTENSIONS_DBP_CONTROLWIZARD_HXX
22 :
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 "dbptypes.hxx"
34 : #include "dbpresid.hrc"
35 : #include "componentmodule.hxx"
36 : #include "wizardcontext.hxx"
37 :
38 : class ResId;
39 :
40 : namespace dbp
41 : {
42 :
43 :
44 :
45 : //= OControlWizardSettings
46 :
47 0 : struct OControlWizardSettings
48 : {
49 : OUString sControlLabel;
50 : };
51 :
52 :
53 : //= OControlWizardPage
54 :
55 : class OControlWizard;
56 : typedef ::svt::OWizardPage OControlWizardPage_Base;
57 : class OControlWizardPage : public OControlWizardPage_Base
58 : {
59 : protected:
60 : FixedLine* m_pFormSettingsSeparator;
61 : FixedText* m_pFormDatasourceLabel;
62 : FixedText* m_pFormDatasource;
63 : FixedText* m_pFormContentTypeLabel;
64 : FixedText* m_pFormContentType;
65 : FixedText* m_pFormTableLabel;
66 : FixedText* m_pFormTable;
67 :
68 : protected:
69 : OControlWizard* getDialog();
70 : const OControlWizard* getDialog() const;
71 : const OControlWizardContext& getContext();
72 : sal_Bool updateContext();
73 : void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True );
74 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
75 : getFormConnection() const;
76 :
77 : public:
78 : OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId );
79 : virtual ~OControlWizardPage();
80 :
81 : protected:
82 : void fillListBox(
83 : ListBox& _rList,
84 : const ::com::sun::star::uno::Sequence< OUString >& _rItems,
85 : sal_Bool _bClear = sal_True);
86 : void fillListBox(
87 : ComboBox& _rList,
88 : const ::com::sun::star::uno::Sequence< OUString >& _rItems,
89 : sal_Bool _bClear = sal_True);
90 :
91 : protected:
92 : void enableFormDatasourceDisplay();
93 : void adjustControlForNoDSDisplay(Control* _pControl, sal_Bool bConstLowerDistance = sal_False);
94 :
95 : protected:
96 : // OWizardPage overridables
97 : virtual void initializePage() SAL_OVERRIDE;
98 : };
99 :
100 : struct OAccessRegulator;
101 :
102 : //= OControlWizard
103 :
104 : typedef ::svt::OWizardMachine OControlWizard_Base;
105 : class OControlWizard : public OControlWizard_Base
106 : {
107 : private:
108 : OControlWizardContext m_aContext;
109 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
110 : m_xContext;
111 :
112 : public:
113 : OControlWizard(
114 : Window* _pParent,
115 : const ResId& _rId,
116 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
117 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
118 : );
119 : virtual ~OControlWizard();
120 :
121 : // make the some base class methods public
122 0 : sal_Bool travelNext() { return OControlWizard_Base::travelNext(); }
123 :
124 : public:
125 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
126 0 : getComponentContext() const { return m_xContext; }
127 :
128 0 : const OControlWizardContext& getContext() const { return m_aContext; }
129 : sal_Bool updateContext(const OAccessRegulator&);
130 : void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True );
131 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
132 : getFormConnection(const OAccessRegulator&) const;
133 :
134 : /** returns the com.sun.star.task.InteractionHandler
135 : @param _pWindow The window will be used when an error message has to be shown.
136 : */
137 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const;
138 :
139 : protected:
140 : // initialize the derivees settings (which have to be derived from OControlWizardSettings)
141 : // with some common data extracted from the control model
142 : void initControlSettings(OControlWizardSettings* _pSettings);
143 : // commit the control-relevant settings
144 : void commitControlSettings(OControlWizardSettings* _pSettings);
145 :
146 : sal_Bool needDatasourceSelection();
147 :
148 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
149 : getFormConnection() const;
150 :
151 : virtual sal_Bool approveControl(sal_Int16 _nClassId) = 0;
152 :
153 : // ModalDialog overridables
154 : virtual short Execute() SAL_OVERRIDE;
155 :
156 : private:
157 : sal_Bool initContext();
158 :
159 : void implGetDSContext();
160 : void implDetermineForm();
161 : void implDeterminePage();
162 : void implDetermineShape();
163 :
164 : // made private. Not to be used by derived (or external) classes
165 : virtual void ActivatePage() SAL_OVERRIDE;
166 : };
167 :
168 :
169 : } // namespace dbp
170 :
171 :
172 : #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|