update dev300-m58
[ooovba.git] / extensions / source / dbpilots / controlwizard.hxx
bloba6bbc6ab9972f2f076c4193fcd7d59af123ca2e3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: controlwizard.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _EXTENSIONS_DBP_CONTROLWIZARD_HXX
32 #define _EXTENSIONS_DBP_CONTROLWIZARD_HXX
34 #include <svtools/wizardmachine.hxx>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/form/FormComponentType.hpp>
37 #include <com/sun/star/sdbc/XConnection.hpp>
38 #include <com/sun/star/task/XInteractionHandler.hpp>
39 #include <vcl/fixed.hxx>
40 #include <vcl/edit.hxx>
41 #ifndef _SV_BUTTON_HXX
42 #include <vcl/button.hxx>
43 #endif
44 #include <vcl/lstbox.hxx>
45 #include <vcl/combobox.hxx>
46 #include "dbptypes.hxx"
47 #ifndef _EXTENSIONS_DBP_DBPRESID_HRC_
48 #include "dbpresid.hrc"
49 #endif
50 #include "componentmodule.hxx"
51 #include "wizardcontext.hxx"
53 class ResId;
54 //.........................................................................
55 namespace dbp
57 //.........................................................................
59 //=====================================================================
60 //= OControlWizardSettings
61 //=====================================================================
62 struct OControlWizardSettings
64 String sControlLabel;
67 //=====================================================================
68 //= OControlWizardPage
69 //=====================================================================
70 class OControlWizard;
71 typedef ::svt::OWizardPage OControlWizardPage_Base;
72 class OControlWizardPage : public OControlWizardPage_Base
74 protected:
75 FixedLine* m_pFormSettingsSeparator;
76 FixedText* m_pFormDatasourceLabel;
77 FixedText* m_pFormDatasource;
78 FixedText* m_pFormContentTypeLabel;
79 FixedText* m_pFormContentType;
80 FixedText* m_pFormTableLabel;
81 FixedText* m_pFormTable;
83 protected:
84 OControlWizard* getDialog();
85 const OControlWizard* getDialog() const;
86 const OControlWizardContext& getContext();
87 sal_Bool updateContext();
88 void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True );
89 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
90 getFormConnection() const;
92 public:
93 OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId );
94 ~OControlWizardPage();
96 protected:
97 void fillListBox(
98 ListBox& _rList,
99 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems,
100 sal_Bool _bClear = sal_True);
101 void fillListBox(
102 ComboBox& _rList,
103 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems,
104 sal_Bool _bClear = sal_True);
106 protected:
107 void enableFormDatasourceDisplay();
108 void adjustControlForNoDSDisplay(Control* _pControl, sal_Bool bConstLowerDistance = sal_False);
110 protected:
111 // OWizardPage overridables
112 virtual void initializePage();
115 struct OAccessRegulator;
116 //=====================================================================
117 //= OControlWizard
118 //=====================================================================
119 typedef ::svt::OWizardMachine OControlWizard_Base;
120 class OControlWizard : public OControlWizard_Base
122 private:
123 OControlWizardContext m_aContext;
125 protected:
126 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
127 m_xORB;
129 public:
130 OControlWizard(
131 Window* _pParent,
132 const ResId& _rId,
133 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
134 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
136 ~OControlWizard();
138 // make the some base class methods public
139 sal_Bool travelNext() { return OControlWizard_Base::travelNext(); }
141 public:
142 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
143 getServiceFactory() const { return m_xORB; }
145 const OControlWizardContext& getContext() const { return m_aContext; }
146 sal_Bool updateContext(const OAccessRegulator&);
147 void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True );
148 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
149 getFormConnection(const OAccessRegulator&) const;
151 /** returns the com.sun.star.sdb.InteractionHandler
152 @param _pWindow The window will be used when an error message has to be shown.
154 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const;
156 protected:
157 // initialize the derivees settings (which have to be derived from OControlWizardSettings)
158 // with some common data extracted from the control model
159 void initControlSettings(OControlWizardSettings* _pSettings);
160 // commit the control-relevant settings
161 void commitControlSettings(OControlWizardSettings* _pSettings);
163 sal_Bool needDatasourceSelection();
165 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
166 getFormConnection() const;
168 virtual sal_Bool approveControl(sal_Int16 _nClassId) = 0;
170 // ModalDialog overridables
171 virtual short Execute();
173 private:
174 sal_Bool initContext();
176 void implGetDSContext();
177 void implDetermineForm();
178 void implDeterminePage();
179 void implDetermineShape();
181 // made private. Not to be used by derived (or external) classes
182 virtual void ActivatePage();
185 //.........................................................................
186 } // namespace dbp
187 //.........................................................................
189 #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX