update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / FieldControls.hxx
blob02a66ee923d3cf5453318eddf77a573fb3468dbf
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: FieldControls.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_FIELDCONTROLS_HXX
31 #define DBAUI_FIELDCONTROLS_HXX
33 #ifndef _SV_FIELD_HXX
34 #include <vcl/field.hxx>
35 #endif
36 #ifndef _SV_LSTBOX_HXX
37 #include <vcl/lstbox.hxx>
38 #endif
39 #ifndef _SV_SVAPP_HXX
40 #include <vcl/svapp.hxx>
41 #endif
42 #ifndef DBAUI_SQLNAMEEDIT_HXX
43 #include "SqlNameEdit.hxx"
44 #endif
45 #ifndef _DBAUI_MODULE_DBU_HXX_
46 #include "moduledbu.hxx"
47 #endif
50 namespace dbaui
52 namespace
54 void lcl_setSpecialReadOnly( BOOL _bReadOnly, Window* _pWin )
56 StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
57 const Color& rNewColor = _bReadOnly ? aSystemStyle.GetDialogColor() : aSystemStyle.GetFieldColor();
58 _pWin->SetBackground(Wallpaper(rNewColor));
59 _pWin->SetControlBackground(rNewColor);
63 //==================================================================
64 class OPropColumnEditCtrl : public OSQLNameEdit
66 OModuleClient m_aModuleClient;
67 short m_nPos;
68 String m_strHelpText;
69 public:
70 inline OPropColumnEditCtrl(Window* pParent, ::rtl::OUString& _rAllowedChars, USHORT nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
72 inline BOOL IsModified() const { return GetText() != GetSavedValue(); }
74 short GetPos() const { return m_nPos; }
75 String GetHelp() const { return m_strHelpText; }
77 virtual void SetSpecialReadOnly(BOOL _bReadOnly)
79 SetReadOnly(_bReadOnly);
80 lcl_setSpecialReadOnly(_bReadOnly,this);
83 inline OPropColumnEditCtrl::OPropColumnEditCtrl(Window* pParent,
84 ::rtl::OUString& _rAllowedChars,
85 USHORT nHelpId,
86 short nPosition,
87 WinBits nWinStyle)
88 :OSQLNameEdit(pParent, _rAllowedChars,nWinStyle)
89 ,m_nPos(nPosition)
91 m_strHelpText=String(ModuleRes(nHelpId));
93 //==================================================================
94 class OPropEditCtrl : public Edit
96 OModuleClient m_aModuleClient;
97 short m_nPos;
98 String m_strHelpText;
100 public:
101 inline OPropEditCtrl(Window* pParent, USHORT nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
102 inline OPropEditCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition = -1);
104 inline BOOL IsModified() const { return GetText() != GetSavedValue(); }
106 short GetPos() const { return m_nPos; }
107 String GetHelp() const { return m_strHelpText; }
109 virtual void SetSpecialReadOnly(BOOL _bReadOnly)
111 SetReadOnly(_bReadOnly);
112 lcl_setSpecialReadOnly(_bReadOnly,this);
116 inline OPropEditCtrl::OPropEditCtrl(Window* pParent, USHORT nHelpId, short nPosition, WinBits nWinStyle)
117 :Edit(pParent, nWinStyle)
118 ,m_nPos(nPosition)
120 m_strHelpText =String(ModuleRes(nHelpId));
122 inline OPropEditCtrl::OPropEditCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition)
123 :Edit(pParent, _rRes)
124 ,m_nPos(nPosition)
126 m_strHelpText =String(ModuleRes(nHelpId));
129 //==================================================================
130 class OPropNumericEditCtrl : public NumericField
132 short m_nPos;
133 String m_strHelpText;
135 public:
136 inline OPropNumericEditCtrl(Window* pParent, USHORT nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
137 inline OPropNumericEditCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition = -1);
139 inline BOOL IsModified() const { return GetText() != GetSavedValue(); }
141 short GetPos() const { return m_nPos; }
142 String GetHelp() const { return m_strHelpText; }
144 virtual void SetSpecialReadOnly(BOOL _bReadOnly)
146 SetReadOnly(_bReadOnly);
147 lcl_setSpecialReadOnly(_bReadOnly,this);
151 inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, USHORT nHelpId, short nPosition, WinBits nWinStyle)
152 :NumericField(pParent, nWinStyle)
153 ,m_nPos(nPosition)
155 m_strHelpText =String(ModuleRes(nHelpId));
157 inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition)
158 :NumericField(pParent, _rRes)
159 ,m_nPos(nPosition)
161 m_strHelpText =String(ModuleRes(nHelpId));
164 //==================================================================
165 class OPropListBoxCtrl : public ListBox
167 short m_nPos;
168 String m_strHelpText;
170 public:
171 inline OPropListBoxCtrl(Window* pParent, USHORT nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
172 inline OPropListBoxCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition = -1);
174 inline BOOL IsModified() const { return GetSelectEntryPos() != GetSavedValue(); }
176 short GetPos() const { return m_nPos; }
177 String GetHelp() const { return m_strHelpText; }
179 virtual void SetSpecialReadOnly(BOOL _bReadOnly)
181 SetReadOnly(_bReadOnly);
182 lcl_setSpecialReadOnly(_bReadOnly,this);
186 inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, USHORT nHelpId, short nPosition, WinBits nWinStyle)
187 :ListBox(pParent, nWinStyle)
188 ,m_nPos(nPosition)
190 m_strHelpText =String(ModuleRes(nHelpId));
192 inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, USHORT nHelpId, const ResId& _rRes,short nPosition)
193 :ListBox(pParent, _rRes)
194 ,m_nPos(nPosition)
196 m_strHelpText =String(ModuleRes(nHelpId));
199 #endif // DBAUI_FIELDCONTROLS_HXX