xref: /aoo4110/main/dbaccess/source/ui/inc/curledit.hxx (revision b1cdbd2c)
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_CURLEDIT_HXX_
25 #define _DBAUI_CURLEDIT_HXX_
26 
27 #ifndef _SV_EDIT_HXX
28 #include <vcl/edit.hxx>
29 #endif
30 #ifndef _SV_FIXED_HXX
31 #include <vcl/fixed.hxx>
32 #endif
33 #ifndef _DBAUI_DSNTYPES_HXX_
34 #include "dsntypes.hxx"
35 #endif
36 #include <memory>
37 
38 //.........................................................................
39 namespace dbaui
40 {
41 //.........................................................................
42 
43 //=========================================================================
44 //= OConnectionURLEdit
45 //=========================================================================
46 /** an edit control which may be used to edit connection URLs like
47 	"sdbc:odbc:" or "jdbc:". It prevents the user from editing this prefix,
48 	though it is normally shown.
49 */
50 class OConnectionURLEdit : public Edit
51 {
52     ::dbaccess::ODsnTypeCollection*
53                         m_pTypeCollection;
54 	FixedText*			m_pForcedPrefix;
55 	String				m_sSaveValueNoPrefix;
56 	sal_Bool				m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
57 
58 public:
59 	OConnectionURLEdit(Window* pParent, const ResId& rResId,sal_Bool _bShowPrefix = sal_False);
60 	~OConnectionURLEdit();
61 
62 public:
63 	// Edit overridables
64 	virtual void	SetText(const String& _rStr);
65 	virtual void	SetText(const String& _rStr, const Selection& _rNewSelection);
66 	virtual String	GetText() const;
67 
68 
69 	/** Showsthe Prefix
70 		@param	_bShowPrefix
71 			If <TRUE/> than the prefix will be visible, otherwise not.
72 	*/
73 	void ShowPrefix(sal_Bool _bShowPrefix);
74 	/// get the currently set text, excluding the prefix indicating the type
75 	virtual String	GetTextNoPrefix() const;
76 	/// set a new text, leave the current prefix unchanged
77 	virtual void	SetTextNoPrefix(const String& _rText);
78 
SaveValueNoPrefix()79 	inline void		SaveValueNoPrefix()				{ m_sSaveValueNoPrefix = GetTextNoPrefix(); }
GetSavedValueNoPrefix() const80 	inline String	GetSavedValueNoPrefix() const	{ return m_sSaveValueNoPrefix; }
SetTypeCollection(::dbaccess::ODsnTypeCollection * _pTypeCollection)81     inline void     SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
82 };
83 
84 //.........................................................................
85 }	// namespace dbaui
86 //.........................................................................
87 
88 #endif // _DBAUI_CURLEDIT_HXX_
89 
90