Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef DBAUI_FIELDCONTROLS_HXX
20 : #define DBAUI_FIELDCONTROLS_HXX
21 :
22 : #include <vcl/field.hxx>
23 : #include <vcl/lstbox.hxx>
24 : #include <vcl/svapp.hxx>
25 : #include "SqlNameEdit.hxx"
26 : #include "moduledbu.hxx"
27 :
28 :
29 : namespace dbaui
30 : {
31 : namespace
32 : {
33 0 : void lcl_setSpecialReadOnly( sal_Bool _bReadOnly, Window* _pWin )
34 : {
35 0 : StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
36 0 : const Color& rNewColor = _bReadOnly ? aSystemStyle.GetDialogColor() : aSystemStyle.GetFieldColor();
37 0 : _pWin->SetBackground(Wallpaper(rNewColor));
38 0 : _pWin->SetControlBackground(rNewColor);
39 0 : }
40 : }
41 :
42 : //==================================================================
43 0 : class OPropColumnEditCtrl : public OSQLNameEdit
44 : {
45 : OModuleClient m_aModuleClient;
46 : short m_nPos;
47 : String m_strHelpText;
48 : public:
49 : inline OPropColumnEditCtrl(Window* pParent, ::rtl::OUString& _rAllowedChars, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
50 :
51 0 : inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
52 :
53 0 : short GetPos() const { return m_nPos; }
54 0 : String GetHelp() const { return m_strHelpText; }
55 :
56 0 : virtual void SetSpecialReadOnly(sal_Bool _bReadOnly)
57 : {
58 0 : SetReadOnly(_bReadOnly);
59 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
60 0 : }
61 : };
62 0 : inline OPropColumnEditCtrl::OPropColumnEditCtrl(Window* pParent,
63 : ::rtl::OUString& _rAllowedChars,
64 : sal_uInt16 nHelpId,
65 : short nPosition,
66 : WinBits nWinStyle)
67 : :OSQLNameEdit(pParent, _rAllowedChars,nWinStyle)
68 0 : ,m_nPos(nPosition)
69 : {
70 0 : m_strHelpText=String(ModuleRes(nHelpId));
71 0 : }
72 : //==================================================================
73 0 : class OPropEditCtrl : public Edit
74 : {
75 : OModuleClient m_aModuleClient;
76 : short m_nPos;
77 : String m_strHelpText;
78 :
79 : public:
80 : inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
81 : inline OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1);
82 :
83 0 : inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
84 :
85 0 : short GetPos() const { return m_nPos; }
86 0 : String GetHelp() const { return m_strHelpText; }
87 :
88 0 : virtual void SetSpecialReadOnly(sal_Bool _bReadOnly)
89 : {
90 0 : SetReadOnly(_bReadOnly);
91 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
92 0 : }
93 : };
94 :
95 0 : inline OPropEditCtrl::OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
96 : :Edit(pParent, nWinStyle)
97 0 : ,m_nPos(nPosition)
98 : {
99 0 : m_strHelpText =String(ModuleRes(nHelpId));
100 0 : }
101 : inline OPropEditCtrl::OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition)
102 : :Edit(pParent, _rRes)
103 : ,m_nPos(nPosition)
104 : {
105 : m_strHelpText =String(ModuleRes(nHelpId));
106 : }
107 :
108 : //==================================================================
109 0 : class OPropNumericEditCtrl : public NumericField
110 : {
111 : short m_nPos;
112 : String m_strHelpText;
113 :
114 : public:
115 : inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
116 : inline OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1);
117 :
118 0 : inline sal_Bool IsModified() const { return GetText() != GetSavedValue(); }
119 :
120 0 : short GetPos() const { return m_nPos; }
121 0 : String GetHelp() const { return m_strHelpText; }
122 :
123 0 : virtual void SetSpecialReadOnly(sal_Bool _bReadOnly)
124 : {
125 0 : SetReadOnly(_bReadOnly);
126 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
127 0 : }
128 : };
129 :
130 0 : inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
131 : :NumericField(pParent, nWinStyle)
132 0 : ,m_nPos(nPosition)
133 : {
134 0 : m_strHelpText =String(ModuleRes(nHelpId));
135 0 : }
136 : inline OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition)
137 : :NumericField(pParent, _rRes)
138 : ,m_nPos(nPosition)
139 : {
140 : m_strHelpText =String(ModuleRes(nHelpId));
141 : }
142 :
143 : //==================================================================
144 0 : class OPropListBoxCtrl : public ListBox
145 : {
146 : short m_nPos;
147 : String m_strHelpText;
148 :
149 : public:
150 : inline OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition = -1, WinBits nWinStyle = 0);
151 : inline OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition = -1);
152 :
153 0 : inline sal_Bool IsModified() const { return GetSelectEntryPos() != GetSavedValue(); }
154 :
155 0 : short GetPos() const { return m_nPos; }
156 0 : String GetHelp() const { return m_strHelpText; }
157 :
158 0 : virtual void SetSpecialReadOnly(sal_Bool _bReadOnly)
159 : {
160 0 : SetReadOnly(_bReadOnly);
161 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
162 0 : }
163 : };
164 :
165 0 : inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
166 : :ListBox(pParent, nWinStyle)
167 0 : ,m_nPos(nPosition)
168 : {
169 0 : m_strHelpText =String(ModuleRes(nHelpId));
170 0 : }
171 : inline OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, const ResId& _rRes,short nPosition)
172 : :ListBox(pParent, _rRes)
173 : ,m_nPos(nPosition)
174 : {
175 : m_strHelpText =String(ModuleRes(nHelpId));
176 : }
177 : }
178 : #endif // DBAUI_FIELDCONTROLS_HXX
179 :
180 :
181 :
182 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|