1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: curledit.hxx,v $
10 * $Revision: 1.8.68.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_CURLEDIT_HXX_
32 #define _DBAUI_CURLEDIT_HXX_
35 #include <vcl/edit.hxx>
38 #include <vcl/fixed.hxx>
40 #ifndef _DBAUI_DSNTYPES_HXX_
41 #include "dsntypes.hxx"
45 //.........................................................................
48 //.........................................................................
50 //=========================================================================
51 //= OConnectionURLEdit
52 //=========================================================================
53 /** an edit control which may be used to edit connection URLs like
54 "sdbc:odbc:" or "jdbc:". It prevents the user from editing this prefix,
55 though it is normally shown.
57 class OConnectionURLEdit
: public Edit
59 ::dbaccess::ODsnTypeCollection
*
61 FixedText
* m_pForcedPrefix
;
62 String m_sSaveValueNoPrefix
;
63 BOOL m_bShowPrefix
; // when <TRUE> the prefix will be visible, otherwise not
66 OConnectionURLEdit(Window
* pParent
, const ResId
& rResId
,BOOL _bShowPrefix
= FALSE
);
67 ~OConnectionURLEdit();
71 virtual void SetText(const String
& _rStr
);
72 virtual void SetText(const String
& _rStr
, const Selection
& _rNewSelection
);
73 virtual String
GetText() const;
78 If <TRUE/> than the prefix will be visible, otherwise not.
80 void ShowPrefix(BOOL _bShowPrefix
);
81 /// get the currently set text, excluding the prefix indicating the type
82 virtual String
GetTextNoPrefix() const;
83 /// set a new text, leave the current prefix unchanged
84 virtual void SetTextNoPrefix(const String
& _rText
);
86 inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix
= GetTextNoPrefix(); }
87 inline String
GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix
; }
88 inline void SetTypeCollection(::dbaccess::ODsnTypeCollection
* _pTypeCollection
) { m_pTypeCollection
= _pTypeCollection
; }
91 //.........................................................................
93 //.........................................................................
95 #endif // _DBAUI_CURLEDIT_HXX_