Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
22 :
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"
37 :
38 : class ResId;
39 :
40 : namespace dbp
41 : {
42 :
43 :
44 :
45 : //= OControlWizardSettings
46 :
47 0 : struct OControlWizardSettings
48 : {
49 : OUString sControlLabel;
50 : };
51 :
52 :
53 : //= OControlWizardPage
54 :
55 : class OControlWizard;
56 : typedef ::svt::OWizardPage OControlWizardPage_Base;
57 : class OControlWizardPage : public OControlWizardPage_Base
58 : {
59 : protected:
60 : FixedText* m_pFormDatasourceLabel;
61 : FixedText* m_pFormDatasource;
62 : FixedText* m_pFormContentTypeLabel;
63 : FixedText* m_pFormContentType;
64 : FixedText* m_pFormTableLabel;
65 : FixedText* m_pFormTable;
66 :
67 : protected:
68 : OControlWizard* getDialog();
69 : const OControlWizard* getDialog() const;
70 : const OControlWizardContext& getContext();
71 : bool updateContext();
72 : void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, bool _bAutoDispose = true );
73 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
74 : getFormConnection() const;
75 : public:
76 : OControlWizardPage( OControlWizard* _pParent, const OString& rID, const OUString& rUIXMLDescription );
77 : virtual ~OControlWizardPage();
78 :
79 : protected:
80 : void fillListBox(
81 : ListBox& _rList,
82 : const ::com::sun::star::uno::Sequence< OUString >& _rItems,
83 : bool _bClear = true);
84 : void fillListBox(
85 : ComboBox& _rList,
86 : const ::com::sun::star::uno::Sequence< OUString >& _rItems,
87 : bool _bClear = true);
88 :
89 : protected:
90 : void enableFormDatasourceDisplay();
91 :
92 : protected:
93 : // OWizardPage overridables
94 : virtual void initializePage() SAL_OVERRIDE;
95 : };
96 :
97 : struct OAccessRegulator;
98 :
99 : //= OControlWizard
100 :
101 : typedef ::svt::OWizardMachine OControlWizard_Base;
102 : class OControlWizard : public OControlWizard_Base
103 : {
104 : private:
105 : OControlWizardContext m_aContext;
106 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
107 : m_xContext;
108 :
109 : public:
110 : OControlWizard(
111 : vcl::Window* _pParent,
112 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
113 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
114 : );
115 : virtual ~OControlWizard();
116 :
117 : // make the some base class methods public
118 0 : bool travelNext() { return OControlWizard_Base::travelNext(); }
119 :
120 : public:
121 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
122 0 : getComponentContext() const { return m_xContext; }
123 :
124 0 : const OControlWizardContext& getContext() const { return m_aContext; }
125 : bool updateContext(const OAccessRegulator&);
126 : void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, bool _bAutoDispose = true );
127 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
128 : getFormConnection(const OAccessRegulator&) const;
129 :
130 : /** returns the com.sun.star.task.InteractionHandler
131 : @param _pWindow The window will be used when an error message has to be shown.
132 : */
133 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(vcl::Window* _pWindow) const;
134 :
135 : protected:
136 : // initialize the derivees settings (which have to be derived from OControlWizardSettings)
137 : // with some common data extracted from the control model
138 : void initControlSettings(OControlWizardSettings* _pSettings);
139 : // commit the control-relevant settings
140 : void commitControlSettings(OControlWizardSettings* _pSettings);
141 :
142 : bool needDatasourceSelection();
143 :
144 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
145 : getFormConnection() const;
146 :
147 : virtual bool approveControl(sal_Int16 _nClassId) = 0;
148 :
149 : // ModalDialog overridables
150 : virtual short Execute() SAL_OVERRIDE;
151 :
152 : private:
153 : bool initContext();
154 :
155 : void implGetDSContext();
156 : void implDetermineForm();
157 : void implDeterminePage();
158 : void implDetermineShape();
159 :
160 : // made private. Not to be used by derived (or external) classes
161 : virtual void ActivatePage() SAL_OVERRIDE;
162 : };
163 :
164 :
165 : } // namespace dbp
166 :
167 :
168 : #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|