bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / dbpilots / controlwizard.hxx
blobccd06a9157e4e0d7c64d2e0d436f31a9606dee2a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
38 class ResId;
39 //.........................................................................
40 namespace dbp
42 //.........................................................................
44 //=====================================================================
45 //= OControlWizardSettings
46 //=====================================================================
47 struct OControlWizardSettings
49 String sControlLabel;
52 //=====================================================================
53 //= OControlWizardPage
54 //=====================================================================
55 class OControlWizard;
56 typedef ::svt::OWizardPage OControlWizardPage_Base;
57 class OControlWizardPage : public OControlWizardPage_Base
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;
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;
77 public:
78 OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId );
79 ~OControlWizardPage();
81 protected:
82 void fillListBox(
83 ListBox& _rList,
84 const ::com::sun::star::uno::Sequence< OUString >& _rItems,
85 sal_Bool _bClear = sal_True);
86 void fillListBox(
87 ComboBox& _rList,
88 const ::com::sun::star::uno::Sequence< OUString >& _rItems,
89 sal_Bool _bClear = sal_True);
91 protected:
92 void enableFormDatasourceDisplay();
93 void adjustControlForNoDSDisplay(Control* _pControl, sal_Bool bConstLowerDistance = sal_False);
95 protected:
96 // OWizardPage overridables
97 virtual void initializePage();
100 struct OAccessRegulator;
101 //=====================================================================
102 //= OControlWizard
103 //=====================================================================
104 typedef ::svt::OWizardMachine OControlWizard_Base;
105 class OControlWizard : public OControlWizard_Base
107 private:
108 OControlWizardContext m_aContext;
109 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
110 m_xContext;
112 public:
113 OControlWizard(
114 Window* _pParent,
115 const ResId& _rId,
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
119 ~OControlWizard();
121 // make the some base class methods public
122 sal_Bool travelNext() { return OControlWizard_Base::travelNext(); }
124 public:
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;
139 protected:
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();
156 private:
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 //.........................................................................
169 } // namespace dbp
170 //.........................................................................
172 #endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */