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 : 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 :
47 : public:
48 : // Edit overridables
49 : virtual void SetText(const OUString& _rStr) SAL_OVERRIDE;
50 : virtual void SetText(const OUString& _rStr, const Selection& _rNewSelection) SAL_OVERRIDE;
51 : virtual OUString GetText() const SAL_OVERRIDE;
52 :
53 : /** Showsthe Prefix
54 : @param _bShowPrefix
55 : If <TRUE/> than the prefix will be visible, otherwise not.
56 : */
57 : void ShowPrefix(bool _bShowPrefix);
58 : /// get the currently set text, excluding the prefix indicating the type
59 : virtual OUString GetTextNoPrefix() const;
60 : /// set a new text, leave the current prefix unchanged
61 : virtual void SetTextNoPrefix(const OUString& _rText);
62 :
63 0 : inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
64 0 : inline OUString GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
65 0 : inline void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
66 : };
67 :
68 : } // namespace dbaui
69 :
70 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|