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 INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
22 :
23 : #include <vcl/edit.hxx>
24 : #include <vcl/fixed.hxx>
25 : #include "dsntypes.hxx"
26 :
27 : namespace dbaui
28 : {
29 :
30 : // OConnectionURLEdit
31 : /** an edit control which may be used to edit connection URLs like
32 : "sdbc:odbc:" or "jdbc:". It prevents the user from editing this prefix,
33 : though it is normally shown.
34 : */
35 : class OConnectionURLEdit : public Edit
36 : {
37 : ::dbaccess::ODsnTypeCollection*
38 : m_pTypeCollection;
39 : VclPtr<FixedText> m_pForcedPrefix;
40 : OUString m_sSaveValueNoPrefix;
41 : bool m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
42 :
43 : public:
44 : OConnectionURLEdit(vcl::Window* pParent, WinBits _nBits,bool _bShowPrefix = false);
45 : virtual ~OConnectionURLEdit();
46 : virtual void dispose() SAL_OVERRIDE;
47 :
48 : public:
49 : // Edit overridables
50 : virtual void SetText(const OUString& _rStr) SAL_OVERRIDE;
51 : virtual void SetText(const OUString& _rStr, const Selection& _rNewSelection) SAL_OVERRIDE;
52 : virtual OUString GetText() const SAL_OVERRIDE;
53 : virtual void Resize() SAL_OVERRIDE;
54 :
55 : /** Showsthe Prefix
56 : @param _bShowPrefix
57 : If <TRUE/> than the prefix will be visible, otherwise not.
58 : */
59 : void ShowPrefix(bool _bShowPrefix);
60 : /// get the currently set text, excluding the prefix indicating the type
61 : OUString GetTextNoPrefix() const;
62 : /// set a new text, leave the current prefix unchanged
63 : void SetTextNoPrefix(const OUString& _rText);
64 :
65 0 : inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
66 0 : inline OUString GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
67 0 : inline void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
68 : };
69 :
70 : } // namespace dbaui
71 :
72 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|