xref: /AOO41X/main/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBAUI_DBSETUPCONNECTIONPAGES_HXX
25 #define DBAUI_DBSETUPCONNECTIONPAGES_HXX
26 
27 #ifndef DBAUI_CONNECTIONPAGESETUP_HXX
28 #include "ConnectionPageSetup.hxx"
29 #endif
30 
31 #include "adminpages.hxx"
32 #include "admincontrols.hxx"
33 #include "curledit.hxx"
34 #include "TextConnectionHelper.hxx"
35 
36 #include <svtools/roadmapwizard.hxx>
37 #include <ucbhelper/content.hxx>
38 #include <vcl/field.hxx>
39 
40 
41 //.........................................................................
42 namespace dbaui
43 
44 {
45 //.........................................................................
46 
47     class IDatabaseSettingsDialog;
48 //      static  OGenericAdministrationPage* CreateDbaseTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
49 
50 
51     //========================================================================
52     //= OSpreadSheetConnectionPageSetup
53     //========================================================================
54     class OSpreadSheetConnectionPageSetup : public OConnectionTabPageSetup
55     {
56     public:
57         virtual sal_Bool        FillItemSet ( SfxItemSet& _rCoreAttrs );
58         static  OGenericAdministrationPage* CreateSpreadSheetTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
59         OSpreadSheetConnectionPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs);
60 
61     protected:
62         CheckBox m_aCBPasswordrequired;
63         virtual ~OSpreadSheetConnectionPageSetup();
64 
65     protected:
66         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
67         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
68         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
69 
70     };
71 
72     //========================================================================
73     //= OTextConnectionPage
74     //========================================================================
75     class OTextConnectionPageSetup : public OConnectionTabPageSetup
76     {
77     public:
78         virtual sal_Bool        FillItemSet ( SfxItemSet& _rCoreAttrs );
79         static  OGenericAdministrationPage* CreateTextTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
80         OTextConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs );
81         OTextConnectionHelper*  m_pTextConnectionHelper;
82     private:
83 
84     protected:
85         virtual ~OTextConnectionPageSetup();
86         virtual sal_Bool prepareLeave();
87         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
88         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
89         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
90         bool    checkTestConnection();
91 
92     private:
93         DECL_LINK(ImplGetExtensionHdl, OTextConnectionHelper*);
94     };
95 
96     //========================================================================
97     //= OLDAPConnectionPageSetup
98     //========================================================================
99     class OLDAPConnectionPageSetup : public OGenericAdministrationPage
100     {
101     public:
102         virtual sal_Bool        FillItemSet ( SfxItemSet& _rCoreAttrs );
103         static  OGenericAdministrationPage* CreateLDAPTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
104         OLDAPConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs );
getControlModifiedLink()105         virtual Link getControlModifiedLink() { return LINK(this, OLDAPConnectionPageSetup, OnEditModified); }
106 
107     protected:
108         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
109         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
110         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
111         DECL_LINK(OnEditModified,Edit*);
112 
113     private:
114         FixedText           m_aFTHeaderText;
115         FixedText           m_aFTHelpText;
116         FixedText           m_aFTHostServer;
117         Edit                m_aETHostServer;
118         FixedText           m_aFTBaseDN;
119         Edit                m_aETBaseDN;
120         FixedText           m_aFTPortNumber;
121         NumericField        m_aNFPortNumber;
122         FixedText           m_aFTDefaultPortNumber;
123         CheckBox            m_aCBUseSSL;
124     };
125 
126     //========================================================================
127     //= MySQLNativeSetupPage
128     //========================================================================
129     class MySQLNativeSetupPage : public OGenericAdministrationPage
130     {
131     private:
132         FixedText           m_aHeader;
133         FixedText           m_aHelpText;
134         MySQLNativeSettings m_aMySQLSettings;
135 
136     public:
137         MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs );
138 
139         static OGenericAdministrationPage* Create( Window* pParent, const SfxItemSet& _rAttrSet );
140 
141     protected:
142         virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList );
143         virtual void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList );
144 
145         virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs );
146         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
147 
148         virtual Link getControlModifiedLink();
149 
150     private:
151         DECL_LINK( OnModified, Edit* );
152     };
153 
154     //========================================================================
155     //= OGeneralSpecialJDBCConnectionPageSetup
156     //========================================================================
157     class OGeneralSpecialJDBCConnectionPageSetup : public OGenericAdministrationPage
158     {
159     public:
160         OGeneralSpecialJDBCConnectionPageSetup(   Window* pParent
161                                         , sal_uInt16 _nResId
162                                         , const SfxItemSet& _rCoreAttrs
163                                         , sal_uInt16 _nPortId
164                                         , sal_uInt16 _nDefaultPortResId
165                                         , sal_uInt16 _nHelpTextResId
166                                         , sal_uInt16 _nHeaderTextResId
167                                         , sal_uInt16 _nDriverClassId );
168     static  OGenericAdministrationPage* CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
169     static  OGenericAdministrationPage* CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
170 
171     protected:
172         virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs );
173         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
174         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
175         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
getControlModifiedLink()176         virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); }
177 
178         DECL_LINK(OnTestJavaClickHdl,PushButton*);
179         DECL_LINK(OnEditModified,Edit*);
180         FixedText           m_aFTHelpText;
181         FixedText           m_aFTDatabasename;
182         Edit                m_aETDatabasename;
183         FixedText           m_aFTHostname;
184         Edit                m_aETHostname;
185         FixedText           m_aFTPortNumber;
186         FixedText           m_aFTDefaultPortNumber;
187         NumericField        m_aNFPortNumber;
188 
189 
190         FixedText           m_aFTDriverClass;
191         Edit                m_aETDriverClass;
192         PushButton          m_aPBTestJavaDriver;
193 
194         String              m_sDefaultJdbcDriverName;
195         sal_uInt16              m_nPortId;
196     };
197 
198 
199     //========================================================================
200     //= OJDBCConnectionPageSetup
201     //========================================================================
202     class OJDBCConnectionPageSetup : public OConnectionTabPageSetup
203     {
204     public:
205                 OJDBCConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs );
206         static  OGenericAdministrationPage* CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
207 
208     protected:
209         virtual bool checkTestConnection();
210 
211         virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs );
212         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
213         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
214         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
215 
216         DECL_LINK(OnTestJavaClickHdl,PushButton*);
217         DECL_LINK(OnEditModified,Edit*);
218         FixedText           m_aFTDriverClass;
219         Edit                m_aETDriverClass;
220         PushButton          m_aPBTestJavaDriver;
221     };
222 
223 
224 
225     //========================================================================
226     //= OJDBCConnectionPageSetup
227     //========================================================================
228     class OMySQLIntroPageSetup : public OGenericAdministrationPage
229     {
230     public:
231         enum ConnectionType
232         {
233             VIA_ODBC,
234             VIA_JDBC,
235             VIA_NATIVE
236         };
237 
238         OMySQLIntroPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs);
239 
240         static OMySQLIntroPageSetup*    CreateMySQLIntroTabPage( Window* _pParent, const SfxItemSet& _rAttrSet );
241         ConnectionType      getMySQLMode();
242         Link                maClickHdl;
SetClickHdl(const Link & rLink)243         void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
GetClickHdl() const244         const Link&         GetClickHdl() const { return maClickHdl; }
245         DECL_LINK(ImplClickHdl, OMySQLIntroPageSetup*);
246 
247 
248 
249 
250     protected:
251         virtual sal_Bool FillItemSet(SfxItemSet& _rSet);
252         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
253         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
254         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
255         virtual ~OMySQLIntroPageSetup();
256 
257     private:
258         RadioButton         m_aRB_ODBCDatabase;
259         RadioButton         m_aRB_JDBCDatabase;
260         RadioButton         m_aRB_NATIVEDatabase;
261         FixedText           m_aFT_ConnectionMode;
262         FixedText           m_aFT_Helptext;
263         FixedText           m_aFT_Headertext;
264 
265         DECL_LINK(OnSetupModeSelected, RadioButton*);
266 
267     };
268 
269 
270 
271 
272     //========================================================================
273     //= OAuthentificationPageSetup
274     //========================================================================
275     class OAuthentificationPageSetup : public OGenericAdministrationPage
276     {
277     public:
278         virtual sal_Bool        FillItemSet ( SfxItemSet& _rCoreAttrs );
279         static  OGenericAdministrationPage* CreateAuthentificationTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
280         OAuthentificationPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs);
281 
282     protected:
283         FixedText   m_aFTHelpText;
284         FixedText   m_aFTHeaderText;
285         FixedText   m_aFTUserName;
286         Edit        m_aETUserName;
287         CheckBox    m_aCBPasswordRequired;
288         PushButton  m_aPBTestConnection;
289         virtual ~OAuthentificationPageSetup();
290 
291     protected:
292         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
293         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
294         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
295     };
296 
297 
298 
299     //========================================================================
300     //= OFinalDBPageSetup
301     //========================================================================
302     class OFinalDBPageSetup : public OGenericAdministrationPage
303     {
304     public:
305         virtual sal_Bool        FillItemSet ( SfxItemSet& _rCoreAttrs );
306         static  OGenericAdministrationPage* CreateFinalDBTabPageSetup( Window* pParent, const SfxItemSet& _rAttrSet);
307 
308         FixedText   m_aFTFinalHeader;
309         FixedText   m_aFTFinalHelpText;
310         RadioButton m_aRBRegisterDataSource;
311         RadioButton m_aRBDontregisterDataSource;
312         FixedText   m_aFTAdditionalSettings;
313         CheckBox    m_aCBOpenAfterwards;
314         CheckBox    m_aCBStartTableWizard;
315         FixedText   m_aFTFinalText;
316 
317         OFinalDBPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs);
318         sal_Bool IsDatabaseDocumentToBeRegistered();
319         sal_Bool IsDatabaseDocumentToBeOpened();
320         sal_Bool IsTableWizardToBeStarted();
321         void enableTableWizardCheckBox( sal_Bool _bSupportsTableCreation);
322 
323         /// may be used in SetXXXHdl calls to controls, is a link to <method>OnControlModified</method>
getControlModifiedLink()324         Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); }
325 
326         DECL_LINK(OnOpenSelected, CheckBox*);
327     protected:
328         virtual ~OFinalDBPageSetup();
329 
330     protected:
331         virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
332         virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
333         virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
334     };
335 
336 //.........................................................................
337 }   // namespace dbaui
338 //.........................................................................
339 
340 #endif
341