1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _DBAUI_DETAILPAGES_HXX_
29 #define _DBAUI_DETAILPAGES_HXX_
30 
31 #ifndef _DBAUI_ADMINPAGES_HXX_
32 #include "adminpages.hxx"
33 #endif
34 #ifndef _DBAUI_CHARSETS_HXX_
35 #include "charsets.hxx"
36 #endif
37 #ifndef CHARSETLISTBOX_HXX
38 #include "charsetlistbox.hxx"
39 #endif
40 #ifndef _SV_FIELD_HXX
41 #include <vcl/field.hxx>
42 #endif
43 #ifndef _SV_FIXED_HXX
44 #include <vcl/fixed.hxx>
45 #endif
46 #ifndef _SV_LSTBOX_HXX
47 #include <vcl/lstbox.hxx>
48 #endif
49 #ifndef _SV_EDIT_HXX
50 #include <vcl/edit.hxx>
51 #endif
52 #ifndef _SV_BUTTON_HXX
53 #include <vcl/button.hxx>
54 #endif
55 #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
56 #include "TextConnectionHelper.hxx"
57 #endif
58 #include "admincontrols.hxx"
59 
60 #include <svtools/dialogcontrolling.hxx>
61 
62 
63 //.........................................................................
64 namespace dbaui
65 {
66 //.........................................................................
67 	//=========================================================================
68 	//= OCommonBehaviourTabPage
69 	//=========================================================================
70 	#define		CBTP_NONE							0x00000000
71 	#define		CBTP_USE_CHARSET					0x00000002
72 	#define		CBTP_USE_OPTIONS					0x00000004
73 
74 	/** eases the implementation of tab pages handling user/password and/or character
75 		set and/or generic options input
76 		<BR>
77 		The controls to be used habe to be defined within the resource, as usual, but
78 		this class does all the handling necessary.
79 	*/
80 	class OCommonBehaviourTabPage : public OGenericAdministrationPage
81 	{
82 	protected:
83 
84 		FixedText*			m_pOptionsLabel;
85 		Edit*				m_pOptions;
86 
87 		FixedLine*			m_pDataConvertFixedLine;
88 		FixedText*			m_pCharsetLabel;
89 		CharSetListBox*     m_pCharset;
90 
91 		FixedLine*			m_pAutoFixedLine;
92 		CheckBox*			m_pAutoRetrievingEnabled;
93 		FixedText*			m_pAutoIncrementLabel;
94 		Edit*				m_pAutoIncrement;
95 		FixedText*			m_pAutoRetrievingLabel;
96 		Edit*				m_pAutoRetrieving;
97 
98 		sal_uInt32			m_nControlFlags;
99 
100 	public:
101 		virtual	sal_Bool		FillItemSet	(SfxItemSet& _rCoreAttrs);
102 
103 		OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nResId, const SfxItemSet& _rCoreAttrs, sal_uInt32 nControlFlags,bool _bFreeResource = true);
104 	protected:
105 
106 			// nControlFlags ist eine Kombination der CBTP_xxx-Konstanten
107 		virtual ~OCommonBehaviourTabPage();
108 
109 		// must be overloaded by subclasses, but it isn't pure virtual
110 		virtual void		implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
111 
112 		// <method>OGenericAdministrationPage::fillControls</method>
113 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
114 
115 		// <method>OGenericAdministrationPage::fillWindows</method>
116 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
117 	};
118 
119 	//========================================================================
120 	//= ODbaseDetailsPage
121 	//========================================================================
122 	class ODbaseDetailsPage : public OCommonBehaviourTabPage
123 	{
124 	public:
125 		virtual	sal_Bool		FillItemSet	( SfxItemSet& _rCoreAttrs );
126 
127 		ODbaseDetailsPage(Window* pParent, const SfxItemSet& _rCoreAttrs);
128 	private:
129 		// please add new controls also to <method>fillControls</method> or <method>fillWindows</method>
130 		CheckBox			m_aShowDeleted;
131 		FixedLine			m_aFL_1;
132 		FixedText			m_aFT_Message;
133 		PushButton			m_aIndexes;
134 
135 		String				m_sDsn;
136 
137 	protected:
138 
139 		virtual ~ODbaseDetailsPage();
140 
141 	protected:
142 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
143 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
144 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
145 
146 	private:
147 		DECL_LINK( OnButtonClicked, Button * );
148 	};
149 
150 	//========================================================================
151 	//= OAdoDetailsPage
152 	//========================================================================
153 	class OAdoDetailsPage : public OCommonBehaviourTabPage
154 	{
155 	protected:
156 		virtual ~OAdoDetailsPage();
157 	public:
158 
159 		OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
160 	};
161 
162 	//========================================================================
163 	//= OOdbcDetailsPage
164 	//========================================================================
165 	class OOdbcDetailsPage : public OCommonBehaviourTabPage
166 	{
167 	public:
168 		virtual	sal_Bool		FillItemSet	( SfxItemSet& _rCoreAttrs );
169 
170 		OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
171 	protected:
172 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
173 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
174 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
175 	private:
176 		FixedLine			m_aFL_1;
177 		CheckBox			m_aUseCatalog;
178 	};
179 
180 
181 	//========================================================================
182 	//= OUserDriverDetailsPage
183 	//========================================================================
184 	class OUserDriverDetailsPage : public OCommonBehaviourTabPage
185 	{
186 	public:
187 		virtual	sal_Bool		FillItemSet	( SfxItemSet& _rCoreAttrs );
188 
189 		OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
190 	protected:
191 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
192 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
193 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
194 	private:
195 		FixedText			m_aFTHostname;
196 		Edit				m_aEDHostname;
197 		FixedText			m_aPortNumber;
198 		NumericField		m_aNFPortNumber;
199 		CheckBox			m_aUseCatalog;
200 	};
201 
202 	//========================================================================
203 	//= OMySQLODBCDetailsPage
204 	//========================================================================
205 	class OMySQLODBCDetailsPage : public OCommonBehaviourTabPage
206 	{
207 	public:
208 		OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
209 	};
210 
211 	//========================================================================
212 	//= OGeneralSpecialJDBCDetailsPage
213 	//========================================================================
214 	class OGeneralSpecialJDBCDetailsPage : public OCommonBehaviourTabPage
215 	{
216 	public:
217 		OGeneralSpecialJDBCDetailsPage(   Window* pParent
218 										, sal_uInt16 _nResId
219 										, const SfxItemSet& _rCoreAttrs
220                                         , sal_uInt16 _nPortId
221 										);
222 
223 	protected:
224 
225 
226 		virtual	sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs );
227 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
228 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
229 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
230 
231 		DECL_LINK(OnTestJavaClickHdl,PushButton*);
232 		DECL_LINK(OnEditModified,Edit*);
233 
234 		FixedLine			m_aFL_1;
235 		FixedText			m_aFTHostname;
236 		Edit				m_aEDHostname;
237 		FixedText			m_aPortNumber;
238 		NumericField		m_aNFPortNumber;
239         FixedText			m_aFTSocket;
240 		Edit				m_aEDSocket;
241 
242 		FixedText			m_aFTDriverClass;
243 		Edit				m_aEDDriverClass;
244 		PushButton			m_aTestJavaDriver;
245 
246 		String				m_sDefaultJdbcDriverName;
247 		sal_uInt16				m_nPortId;
248         bool                m_bUseClass;
249 	};
250 
251 	//========================================================================
252 	//= MySQLNativePage
253 	//========================================================================
254 	class MySQLNativePage : public OCommonBehaviourTabPage
255 	{
256 	public:
257 		MySQLNativePage(    Window* pParent,
258 							const SfxItemSet& _rCoreAttrs );
259 
260     private:
261 		FixedLine			m_aSeparator1;
262         MySQLNativeSettings m_aMySQLSettings;
263 
264 		FixedLine			m_aSeparator2;
265         FixedText			m_aUserNameLabel;
266 		Edit				m_aUserName;
267 		CheckBox			m_aPasswordRequired;
268 
269 	protected:
270 		virtual	sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs );
271 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
272 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
273 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
274 	};
275 
276 	//========================================================================
277 	//= OAdabasDetailsPage
278 	//========================================================================
279 	class OAdabasDetailsPage : public OCommonBehaviourTabPage
280 	{
281 	public:
282 		virtual	sal_Bool		FillItemSet	(SfxItemSet& _rCoreAttrs);
283 
284 		OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
285 	protected:
286 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
287 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
288 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
289 
290 	private:
291 		FixedText			m_aFTHostname;
292 		Edit				m_aEDHostname;
293 		FixedLine			m_aFL_1;
294 		FixedText			m_FT_CACHE_SIZE;
295 		NumericField		m_NF_CACHE_SIZE;
296 
297 		FixedText			m_FT_DATA_INCREMENT;
298 		NumericField		m_NF_DATA_INCREMENT;
299 
300 		FixedLine			m_aFL_2;
301 		FixedText			m_FT_CTRLUSERNAME;
302 		Edit				m_ET_CTRLUSERNAME;
303 		FixedText			m_FT_CTRLPASSWORD;
304 		Edit				m_ET_CTRLPASSWORD;
305 
306 		CheckBox			m_CB_SHUTDB;
307 		PushButton			m_PB_STAT;
308 		String				m_sUser;
309 		sal_Bool				bAttrsChanged;
310 
311 		DECL_LINK( AttributesChangedHdl,	void * );
312 		DECL_LINK( UserSettingsHdl,			void * );
313 		DECL_LINK( LoseFocusHdl,			Edit * );
314 		DECL_LINK( PBClickHdl,				Button *);
315 	};
316 
317 	//========================================================================
318 	//= OOdbcDetailsPage
319 	//========================================================================
320 	class OLDAPDetailsPage : public OCommonBehaviourTabPage
321 	{
322 	public:
323 		virtual	sal_Bool		FillItemSet	( SfxItemSet& _rCoreAttrs );
324 
325 		OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
326 	protected:
327 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
328 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
329 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
330 	private:
331 		FixedLine			m_aFL_1;
332 		FixedText			m_aBaseDN;
333 		Edit				m_aETBaseDN;
334 		CheckBox			m_aCBUseSSL;
335 		FixedText			m_aPortNumber;
336 		NumericField		m_aNFPortNumber;
337 		FixedText			m_aFTRowCount;
338 		NumericField		m_aNFRowCount;
339 
340 		sal_Int32			m_iSSLPort;
341 		sal_Int32			m_iNormalPort;
342 		DECL_LINK( OnCheckBoxClick, CheckBox * );
343 	};
344 
345 	//========================================================================
346 	//= OMozillaDetailsPage Detail page for Mozilla and Thunderbird addressbook
347 	//========================================================================
348 	class OMozillaDetailsPage : public OCommonBehaviourTabPage
349 	{
350 	protected:
351 		virtual ~OMozillaDetailsPage();
352 	public:
353 
354 		OMozillaDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
355 	};
356 
357 	//========================================================================
358 	//= OTextDetailsPage
359 	//========================================================================
360 	class OTextDetailsPage : public OCommonBehaviourTabPage
361 	{
362 	public:
363 		virtual	sal_Bool		FillItemSet	( SfxItemSet& _rCoreAttrs );
364 
365 		OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
366         OTextConnectionHelper*  m_pTextConnectionHelper;
367 
368 	private:
369 
370 		String		m_aFieldSeparatorList;
371 		String		m_aTextSeparatorList;
372 		String		m_aTextNone;
373 	protected:
374 		virtual ~OTextDetailsPage();
375 		virtual sal_Bool prepareLeave();
376 
377 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
378 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
379 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
380 
381 	private:
382 	};
383 
384 //.........................................................................
385 }	// namespace dbaui
386 //.........................................................................
387 
388 #endif // _DBAUI_DETAILPAGES_HXX_
389