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