1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FieldControls.hxx,v $
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
34 #include <vcl/field.hxx>
36 #ifndef _SV_LSTBOX_HXX
37 #include <vcl/lstbox.hxx>
40 #include <vcl/svapp.hxx>
42 #ifndef DBAUI_SQLNAMEEDIT_HXX
43 #include "SqlNameEdit.hxx"
45 #ifndef _DBAUI_MODULE_DBU_HXX_
46 #include "moduledbu.hxx"
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
;
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
,
88 :OSQLNameEdit(pParent
, _rAllowedChars
,nWinStyle
)
91 m_strHelpText
=String(ModuleRes(nHelpId
));
93 //==================================================================
94 class OPropEditCtrl
: public Edit
96 OModuleClient m_aModuleClient
;
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
)
120 m_strHelpText
=String(ModuleRes(nHelpId
));
122 inline OPropEditCtrl::OPropEditCtrl(Window
* pParent
, USHORT nHelpId
, const ResId
& _rRes
,short nPosition
)
123 :Edit(pParent
, _rRes
)
126 m_strHelpText
=String(ModuleRes(nHelpId
));
129 //==================================================================
130 class OPropNumericEditCtrl
: public NumericField
133 String m_strHelpText
;
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
)
155 m_strHelpText
=String(ModuleRes(nHelpId
));
157 inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window
* pParent
, USHORT nHelpId
, const ResId
& _rRes
,short nPosition
)
158 :NumericField(pParent
, _rRes
)
161 m_strHelpText
=String(ModuleRes(nHelpId
));
164 //==================================================================
165 class OPropListBoxCtrl
: public ListBox
168 String m_strHelpText
;
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
)
190 m_strHelpText
=String(ModuleRes(nHelpId
));
192 inline OPropListBoxCtrl::OPropListBoxCtrl(Window
* pParent
, USHORT nHelpId
, const ResId
& _rRes
,short nPosition
)
193 :ListBox(pParent
, _rRes
)
196 m_strHelpText
=String(ModuleRes(nHelpId
));
199 #endif // DBAUI_FIELDCONTROLS_HXX