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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
22 #include <vcl/edit.hxx>
23 #include <vcl/combobox.hxx>
29 OUString m_sAllowedChars
;
30 bool m_bOnlyUpperCase
;
31 bool m_bCheck
; // true when we should check for invalid chars
33 OSQLNameChecker(const OUString
& _rAllowedChars
)
34 :m_sAllowedChars(_rAllowedChars
)
35 ,m_bOnlyUpperCase(false)
40 void setUpperCase(bool _bUpper
=true)
42 m_bOnlyUpperCase
= _bUpper
;
44 void setAllowedChars(const OUString
& _rAllowedChars
)
46 m_sAllowedChars
= _rAllowedChars
;
48 // default is false because it is initialized with true
49 void setCheck(bool _bCheck
= false)
53 bool checkString(const OUString
& _sToCheck
,OUString
& _rsCorrected
);
55 class OSQLNameEdit
: public Edit
56 ,public OSQLNameChecker
59 OSQLNameEdit(vcl::Window
* _pParent
,WinBits nStyle
= WB_BORDER
, const OUString
& _rAllowedChars
= OUString())
60 : Edit(_pParent
,nStyle
)
61 ,OSQLNameChecker(_rAllowedChars
)
64 OSQLNameEdit(vcl::Window
* _pParent
,const ResId
& _rRes
,const OUString
& _rAllowedChars
= OUString())
65 : Edit(_pParent
,_rRes
)
66 ,OSQLNameChecker(_rAllowedChars
)
71 // virtual bool PreNotify( NotifyEvent& rNEvt );
73 virtual void Modify() SAL_OVERRIDE
;
76 class OSQLNameComboBox
: public ComboBox
77 ,public OSQLNameChecker
80 OSQLNameComboBox(vcl::Window
* _pParent
,WinBits nStyle
= WB_BORDER
, const OUString
& _rAllowedChars
= OUString())
81 : ComboBox(_pParent
,nStyle
)
82 , OSQLNameChecker(_rAllowedChars
)
85 OSQLNameComboBox(vcl::Window
* _pParent
,const ResId
& _rRes
,const OUString
& _rAllowedChars
= OUString())
86 : ComboBox(_pParent
,_rRes
)
87 , OSQLNameChecker(_rAllowedChars
)
93 virtual void Modify() SAL_OVERRIDE
;
97 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */