1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10*2e2212a7SAndrew Rist * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2e2212a7SAndrew Rist * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19*2e2212a7SAndrew Rist * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBAUI_FIELDCONTROLS_HXX 24cdf0e10cSrcweir #define DBAUI_FIELDCONTROLS_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef _SV_FIELD_HXX 27cdf0e10cSrcweir #include <vcl/field.hxx> 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef _SV_LSTBOX_HXX 30cdf0e10cSrcweir #include <vcl/lstbox.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX 33cdf0e10cSrcweir #include <vcl/svapp.hxx> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef DBAUI_SQLNAMEEDIT_HXX 36cdf0e10cSrcweir #include "SqlNameEdit.hxx" 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_ 39cdf0e10cSrcweir #include "moduledbu.hxx" 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir namespace dbaui 44cdf0e10cSrcweir { 45cdf0e10cSrcweir namespace 46cdf0e10cSrcweir { lcl_setSpecialReadOnly(sal_Bool _bReadOnly,Window * _pWin)47cdf0e10cSrcweir void lcl_setSpecialReadOnly( sal_Bool _bReadOnly, Window* _pWin ) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); 50cdf0e10cSrcweir const Color& rNewColor = _bReadOnly ? aSystemStyle.GetDialogColor() : aSystemStyle.GetFieldColor(); 51cdf0e10cSrcweir _pWin->SetBackground(Wallpaper(rNewColor)); 52cdf0e10cSrcweir _pWin->SetControlBackground(rNewColor); 53cdf0e10cSrcweir } 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir //================================================================== 57cdf0e10cSrcweir class OPropColumnEditCtrl : public OSQLNameEdit 58cdf0e10cSrcweir { 59cdf0e10cSrcweir OModuleClient m_aModuleClient; 60cdf0e10cSrcweir short m_nPos; 61cdf0e10cSrcweir String m_strHelpText; 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir inline OPropColumnEditCtrl(Window* pParent, ::rtl::OUString& _rAllowedChars, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0); 64cdf0e10cSrcweir IsModified() const65cdf0e10cSrcweir inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); } 66cdf0e10cSrcweir GetPos() const67cdf0e10cSrcweir short GetPos() const { return m_nPos; } GetHelp() const68cdf0e10cSrcweir String GetHelp() const { return m_strHelpText; } 69cdf0e10cSrcweir SetSpecialReadOnly(sal_Bool _bReadOnly)70cdf0e10cSrcweir virtual void SetSpecialReadOnly(sal_Bool _bReadOnly) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir SetReadOnly(_bReadOnly); 73cdf0e10cSrcweir lcl_setSpecialReadOnly(_bReadOnly,this); 74cdf0e10cSrcweir } 75cdf0e10cSrcweir }; OPropColumnEditCtrl(Window * pParent,::rtl::OUString & _rAllowedChars,sal_uInt16 nHelpId,short nPosition,WinBits nWinStyle)76cdf0e10cSrcweir inline OPropColumnEditCtrl::OPropColumnEditCtrl(Window* pParent, 77cdf0e10cSrcweir ::rtl::OUString& _rAllowedChars, 78cdf0e10cSrcweir sal_uInt16 nHelpId, 79cdf0e10cSrcweir short nPosition, 80cdf0e10cSrcweir WinBits nWinStyle) 81cdf0e10cSrcweir :OSQLNameEdit(pParent, _rAllowedChars,nWinStyle) 82cdf0e10cSrcweir ,m_nPos(nPosition) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir m_strHelpText=String(ModuleRes(nHelpId)); 85cdf0e10cSrcweir } 86cdf0e10cSrcweir //================================================================== 87cdf0e10cSrcweir class OPropEditCtrl : public Edit 88cdf0e10cSrcweir { 89cdf0e10cSrcweir OModuleClient m_aModuleClient; 90cdf0e10cSrcweir short m_nPos; 91cdf0e10cSrcweir String m_strHelpText; 92cdf0e10cSrcweir 93cdf0e10cSrcweir public: 94cdf0e10cSrcweir inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0); 95cdf0e10cSrcweir inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1); 96cdf0e10cSrcweir IsModified() const97cdf0e10cSrcweir inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); } 98cdf0e10cSrcweir GetPos() const99cdf0e10cSrcweir short GetPos() const { return m_nPos; } GetHelp() const100cdf0e10cSrcweir String GetHelp() const { return m_strHelpText; } 101cdf0e10cSrcweir SetSpecialReadOnly(sal_Bool _bReadOnly)102cdf0e10cSrcweir virtual void SetSpecialReadOnly(sal_Bool _bReadOnly) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir SetReadOnly(_bReadOnly); 105cdf0e10cSrcweir lcl_setSpecialReadOnly(_bReadOnly,this); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir }; 108cdf0e10cSrcweir OPropEditCtrl(Window * pParent,sal_uInt16 nHelpId,short nPosition,WinBits nWinStyle)109cdf0e10cSrcweir inline OPropEditCtrl::OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle) 110cdf0e10cSrcweir :Edit(pParent, nWinStyle) 111cdf0e10cSrcweir ,m_nPos(nPosition) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 114cdf0e10cSrcweir } OPropEditCtrl(Window * pParent,sal_uInt16 nHelpId,const ResId & _rRes,short nPosition)115cdf0e10cSrcweir inline OPropEditCtrl::OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition) 116cdf0e10cSrcweir :Edit(pParent, _rRes) 117cdf0e10cSrcweir ,m_nPos(nPosition) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir //================================================================== 123cdf0e10cSrcweir class OPropNumericEditCtrl : public NumericField 124cdf0e10cSrcweir { 125cdf0e10cSrcweir short m_nPos; 126cdf0e10cSrcweir String m_strHelpText; 127cdf0e10cSrcweir 128cdf0e10cSrcweir public: 129cdf0e10cSrcweir inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0); 130cdf0e10cSrcweir inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1); 131cdf0e10cSrcweir IsModified() const132cdf0e10cSrcweir inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); } 133cdf0e10cSrcweir GetPos() const134cdf0e10cSrcweir short GetPos() const { return m_nPos; } GetHelp() const135cdf0e10cSrcweir String GetHelp() const { return m_strHelpText; } 136cdf0e10cSrcweir SetSpecialReadOnly(sal_Bool _bReadOnly)137cdf0e10cSrcweir virtual void SetSpecialReadOnly(sal_Bool _bReadOnly) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir SetReadOnly(_bReadOnly); 140cdf0e10cSrcweir lcl_setSpecialReadOnly(_bReadOnly,this); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir }; 143cdf0e10cSrcweir OPropNumericEditCtrl(Window * pParent,sal_uInt16 nHelpId,short nPosition,WinBits nWinStyle)144cdf0e10cSrcweir inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle) 145cdf0e10cSrcweir :NumericField(pParent, nWinStyle) 146cdf0e10cSrcweir ,m_nPos(nPosition) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 149cdf0e10cSrcweir } OPropNumericEditCtrl(Window * pParent,sal_uInt16 nHelpId,const ResId & _rRes,short nPosition)150cdf0e10cSrcweir inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition) 151cdf0e10cSrcweir :NumericField(pParent, _rRes) 152cdf0e10cSrcweir ,m_nPos(nPosition) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir //================================================================== 158cdf0e10cSrcweir class OPropListBoxCtrl : public ListBox 159cdf0e10cSrcweir { 160cdf0e10cSrcweir short m_nPos; 161cdf0e10cSrcweir String m_strHelpText; 162cdf0e10cSrcweir 163cdf0e10cSrcweir public: 164cdf0e10cSrcweir inline OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0); 165cdf0e10cSrcweir inline OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1); 166cdf0e10cSrcweir IsModified() const167cdf0e10cSrcweir inline sal_Bool IsModified() const { return GetSelectEntryPos() != GetSavedValue(); } 168cdf0e10cSrcweir GetPos() const169cdf0e10cSrcweir short GetPos() const { return m_nPos; } GetHelp() const170cdf0e10cSrcweir String GetHelp() const { return m_strHelpText; } 171cdf0e10cSrcweir SetSpecialReadOnly(sal_Bool _bReadOnly)172cdf0e10cSrcweir virtual void SetSpecialReadOnly(sal_Bool _bReadOnly) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir SetReadOnly(_bReadOnly); 175cdf0e10cSrcweir lcl_setSpecialReadOnly(_bReadOnly,this); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir }; 178cdf0e10cSrcweir OPropListBoxCtrl(Window * pParent,sal_uInt16 nHelpId,short nPosition,WinBits nWinStyle)179cdf0e10cSrcweir inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle) 180cdf0e10cSrcweir :ListBox(pParent, nWinStyle) 181cdf0e10cSrcweir ,m_nPos(nPosition) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 184cdf0e10cSrcweir } OPropListBoxCtrl(Window * pParent,sal_uInt16 nHelpId,const ResId & _rRes,short nPosition)185cdf0e10cSrcweir inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition) 186cdf0e10cSrcweir :ListBox(pParent, _rRes) 187cdf0e10cSrcweir ,m_nPos(nPosition) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir m_strHelpText =String(ModuleRes(nHelpId)); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } 192cdf0e10cSrcweir #endif // DBAUI_FIELDCONTROLS_HXX 193cdf0e10cSrcweir 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196