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>
41 #include <vcl/lstbox.hxx>
42 #include <vcl/combobox.hxx>
43 #include "dbptypes.hxx"
44 #ifndef _EXTENSIONS_DBP_DBPRESID_HRC_
45 #include "dbpresid.hrc"
47 #include "componentmodule.hxx"
48 #include "wizardcontext.hxx"
51 //.........................................................................
54 //.........................................................................
56 //=====================================================================
57 //= OControlWizardSettings
58 //=====================================================================
59 struct OControlWizardSettings
64 //=====================================================================
65 //= OControlWizardPage
66 //=====================================================================
68 typedef ::svt::OWizardPage OControlWizardPage_Base
;
69 class OControlWizardPage
: public OControlWizardPage_Base
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
;
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;
90 OControlWizardPage( OControlWizard
* _pParent
, const ResId
& _rResId
);
91 ~OControlWizardPage();
96 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rItems
,
97 sal_Bool _bClear
= sal_True
);
100 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rItems
,
101 sal_Bool _bClear
= sal_True
);
104 void enableFormDatasourceDisplay();
105 void adjustControlForNoDSDisplay(Control
* _pControl
, sal_Bool bConstLowerDistance
= sal_False
);
108 // OWizardPage overridables
109 virtual void initializePage();
112 struct OAccessRegulator
;
113 //=====================================================================
115 //=====================================================================
116 typedef ::svt::OWizardMachine OControlWizard_Base
;
117 class OControlWizard
: public OControlWizard_Base
120 OControlWizardContext m_aContext
;
123 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
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
135 // make the some base class methods public
136 sal_Bool
travelNext() { return OControlWizard_Base::travelNext(); }
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;
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();
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 //.........................................................................
184 //.........................................................................
186 #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX