update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / SqlNameEdit.hxx
blobce72bc17e50e74bddd10b74480b44ba6a71e9020
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SqlNameEdit.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_SQLNAMEEDIT_HXX
31 #define DBAUI_SQLNAMEEDIT_HXX
33 #ifndef _SV_EDIT_HXX
34 #include <vcl/edit.hxx>
35 #endif
36 #ifndef _SV_COMBOBOX_HXX
37 #include <vcl/combobox.hxx>
38 #endif
40 namespace dbaui
42 class OSQLNameChecker
44 ::rtl::OUString m_sAllowedChars;
45 sal_Bool m_bOnlyUpperCase;
46 sal_Bool m_bCheck; // true when we should check for invalid chars
47 public:
48 OSQLNameChecker(const ::rtl::OUString& _rAllowedChars)
49 :m_sAllowedChars(_rAllowedChars)
50 ,m_bOnlyUpperCase(sal_False)
51 ,m_bCheck(sal_True)
55 void setUpperCase(sal_Bool _bUpper=sal_True)
57 m_bOnlyUpperCase = _bUpper;
59 void setAllowedChars(const ::rtl::OUString& _rAllowedChars)
61 m_sAllowedChars = _rAllowedChars;
63 // default is false because it is initialized with true
64 void setCheck(sal_Bool _bCheck = sal_False)
66 m_bCheck = _bCheck;
68 sal_Bool checkString(const ::rtl::OUString& _sOldValue,const ::rtl::OUString& _sToCheck,::rtl::OUString& _rsCorrected);
70 //==================================================================
71 class OSQLNameEdit : public Edit
72 ,public OSQLNameChecker
74 public:
75 OSQLNameEdit(Window* _pParent,const ::rtl::OUString& _rAllowedChars, WinBits nStyle = WB_BORDER)
76 : Edit(_pParent,nStyle)
77 ,OSQLNameChecker(_rAllowedChars)
80 OSQLNameEdit(Window* _pParent,const ResId& _rRes,const ::rtl::OUString& _rAllowedChars = ::rtl::OUString())
81 : Edit(_pParent,_rRes)
82 ,OSQLNameChecker(_rAllowedChars)
86 // Window overload
87 // virtual long PreNotify( NotifyEvent& rNEvt );
88 // Edit
89 virtual void Modify();
92 class OSQLNameComboBox : public ComboBox
93 ,public OSQLNameChecker
95 public:
96 OSQLNameComboBox(Window* _pParent,const ::rtl::OUString& _rAllowedChars, WinBits nStyle = WB_BORDER)
97 : ComboBox(_pParent,nStyle)
98 ,OSQLNameChecker(_rAllowedChars)
101 OSQLNameComboBox(Window* _pParent,const ResId& _rRes,const ::rtl::OUString& _rAllowedChars = ::rtl::OUString())
102 : ComboBox(_pParent,_rRes)
103 ,OSQLNameChecker(_rAllowedChars)
107 // Window overload
108 // Edit
109 virtual void Modify();
113 #endif // DBAUI_SQLNAMEEDIT_HXX