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