1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
23 #include <vcl/edit.hxx>
24 #include <vcl/fixed.hxx>
25 #include "dsntypes.hxx"
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.
35 class OConnectionURLEdit
: public Edit
37 ::dbaccess::ODsnTypeCollection
*
39 VclPtr
<FixedText
> m_pForcedPrefix
;
40 OUString m_sSaveValueNoPrefix
;
41 bool m_bShowPrefix
; // when <TRUE> the prefix will be visible, otherwise not
44 OConnectionURLEdit(vcl::Window
* pParent
, WinBits _nBits
,bool _bShowPrefix
= false);
45 virtual ~OConnectionURLEdit();
46 virtual void dispose() SAL_OVERRIDE
;
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
;
57 If <TRUE/> than the prefix will be visible, otherwise not.
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
);
65 inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix
= GetTextNoPrefix(); }
66 inline OUString
GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix
; }
67 inline void SetTypeCollection(::dbaccess::ODsnTypeCollection
* _pTypeCollection
) { m_pTypeCollection
= _pTypeCollection
; }
72 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CURLEDIT_HXX
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */