Branch data 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 : : String 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 : : ~OControlWizardPage();
80 : :
81 : : protected:
82 : : void fillListBox(
83 : : ListBox& _rList,
84 : : const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems,
85 : : sal_Bool _bClear = sal_True);
86 : : void fillListBox(
87 : : ComboBox& _rList,
88 : : const ::com::sun::star::uno::Sequence< ::rtl::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();
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 : :
110 : : protected:
111 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
112 : : m_xORB;
113 : :
114 : : public:
115 : : OControlWizard(
116 : : Window* _pParent,
117 : : const ResId& _rId,
118 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
119 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
120 : : );
121 : : ~OControlWizard();
122 : :
123 : : // make the some base class methods public
124 : 0 : sal_Bool travelNext() { return OControlWizard_Base::travelNext(); }
125 : :
126 : : public:
127 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
128 : 0 : getServiceFactory() const { return m_xORB; }
129 : :
130 : 0 : const OControlWizardContext& getContext() const { return m_aContext; }
131 : : sal_Bool updateContext(const OAccessRegulator&);
132 : : void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True );
133 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
134 : : getFormConnection(const OAccessRegulator&) const;
135 : :
136 : : /** returns the com.sun.star.task.InteractionHandler
137 : : @param _pWindow The window will be used when an error message has to be shown.
138 : : */
139 : : ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const;
140 : :
141 : : protected:
142 : : // initialize the derivees settings (which have to be derived from OControlWizardSettings)
143 : : // with some common data extracted from the control model
144 : : void initControlSettings(OControlWizardSettings* _pSettings);
145 : : // commit the control-relevant settings
146 : : void commitControlSettings(OControlWizardSettings* _pSettings);
147 : :
148 : : sal_Bool needDatasourceSelection();
149 : :
150 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
151 : : getFormConnection() const;
152 : :
153 : : virtual sal_Bool approveControl(sal_Int16 _nClassId) = 0;
154 : :
155 : : // ModalDialog overridables
156 : : virtual short Execute();
157 : :
158 : : private:
159 : : sal_Bool initContext();
160 : :
161 : : void implGetDSContext();
162 : : void implDetermineForm();
163 : : void implDeterminePage();
164 : : void implDetermineShape();
165 : :
166 : : // made private. Not to be used by derived (or external) classes
167 : : virtual void ActivatePage();
168 : : };
169 : :
170 : : //.........................................................................
171 : : } // namespace dbp
172 : : //.........................................................................
173 : :
174 : : #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX
175 : :
176 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|