1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _EXTENSIONS_DBP_CONTROLWIZARD_HXX
21 #define _EXTENSIONS_DBP_CONTROLWIZARD_HXX
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"
39 //.........................................................................
42 //.........................................................................
44 //=====================================================================
45 //= OControlWizardSettings
46 //=====================================================================
47 struct OControlWizardSettings
52 //=====================================================================
53 //= OControlWizardPage
54 //=====================================================================
56 typedef ::svt::OWizardPage OControlWizardPage_Base
;
57 class OControlWizardPage
: public OControlWizardPage_Base
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
;
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;
78 OControlWizardPage( OControlWizard
* _pParent
, const ResId
& _rResId
);
79 ~OControlWizardPage();
84 const ::com::sun::star::uno::Sequence
< OUString
>& _rItems
,
85 sal_Bool _bClear
= sal_True
);
88 const ::com::sun::star::uno::Sequence
< OUString
>& _rItems
,
89 sal_Bool _bClear
= sal_True
);
92 void enableFormDatasourceDisplay();
93 void adjustControlForNoDSDisplay(Control
* _pControl
, sal_Bool bConstLowerDistance
= sal_False
);
96 // OWizardPage overridables
97 virtual void initializePage();
100 struct OAccessRegulator
;
101 //=====================================================================
103 //=====================================================================
104 typedef ::svt::OWizardMachine OControlWizard_Base
;
105 class OControlWizard
: public OControlWizard_Base
108 OControlWizardContext m_aContext
;
109 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
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
121 // make the some base class methods public
122 sal_Bool
travelNext() { return OControlWizard_Base::travelNext(); }
125 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
126 getComponentContext() const { return m_xContext
; }
128 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;
134 /** returns the com.sun.star.task.InteractionHandler
135 @param _pWindow The window will be used when an error message has to be shown.
137 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
> getInteractionHandler(Window
* _pWindow
) const;
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
);
146 sal_Bool
needDatasourceSelection();
148 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
149 getFormConnection() const;
151 virtual sal_Bool
approveControl(sal_Int16 _nClassId
) = 0;
153 // ModalDialog overridables
154 virtual short Execute();
157 sal_Bool
initContext();
159 void implGetDSContext();
160 void implDetermineForm();
161 void implDeterminePage();
162 void implDetermineShape();
164 // made private. Not to be used by derived (or external) classes
165 virtual void ActivatePage();
168 //.........................................................................
170 //.........................................................................
172 #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */