Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _DBAUI_CURLEDIT_HXX_
21 : #define _DBAUI_CURLEDIT_HXX_
22 :
23 : #include <vcl/edit.hxx>
24 : #include <vcl/fixed.hxx>
25 : #include "dsntypes.hxx"
26 : #include <memory>
27 :
28 : //.........................................................................
29 : namespace dbaui
30 : {
31 : //.........................................................................
32 :
33 : //=========================================================================
34 : //= OConnectionURLEdit
35 : //=========================================================================
36 : /** an edit control which may be used to edit connection URLs like
37 : "sdbc:odbc:" or "jdbc:". It prevents the user from editing this prefix,
38 : though it is normally shown.
39 : */
40 : class OConnectionURLEdit : public Edit
41 : {
42 : ::dbaccess::ODsnTypeCollection*
43 : m_pTypeCollection;
44 : FixedText* m_pForcedPrefix;
45 : String m_sSaveValueNoPrefix;
46 : sal_Bool m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
47 :
48 : public:
49 : OConnectionURLEdit(Window* pParent, const ResId& rResId,sal_Bool _bShowPrefix = sal_False);
50 : ~OConnectionURLEdit();
51 :
52 : public:
53 : // Edit overridables
54 : virtual void SetText(const String& _rStr);
55 : virtual void SetText(const String& _rStr, const Selection& _rNewSelection);
56 : virtual String GetText() const;
57 :
58 :
59 : /** Showsthe Prefix
60 : @param _bShowPrefix
61 : If <TRUE/> than the prefix will be visible, otherwise not.
62 : */
63 : void ShowPrefix(sal_Bool _bShowPrefix);
64 : /// get the currently set text, excluding the prefix indicating the type
65 : virtual String GetTextNoPrefix() const;
66 : /// set a new text, leave the current prefix unchanged
67 : virtual void SetTextNoPrefix(const String& _rText);
68 :
69 0 : inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
70 0 : inline String GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
71 0 : inline void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
72 : };
73 :
74 : //.........................................................................
75 : } // namespace dbaui
76 : //.........................................................................
77 :
78 : #endif // _DBAUI_CURLEDIT_HXX_
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|