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