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 :
20 : #include "FieldControls.hxx"
21 : #include "SqlNameEdit.hxx"
22 :
23 : #include <vcl/settings.hxx>
24 :
25 : namespace dbaui {
26 :
27 : namespace {
28 :
29 0 : void lcl_setSpecialReadOnly( sal_Bool _bReadOnly, Window* _pWin )
30 : {
31 0 : StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
32 0 : const Color& rNewColor = _bReadOnly ? aSystemStyle.GetDialogColor() : aSystemStyle.GetFieldColor();
33 0 : _pWin->SetBackground(Wallpaper(rNewColor));
34 0 : _pWin->SetControlBackground(rNewColor);
35 0 : }
36 :
37 : }
38 :
39 0 : OPropColumnEditCtrl::OPropColumnEditCtrl(Window* pParent,
40 : rtl::OUString& _rAllowedChars,
41 : sal_uInt16 nHelpId,
42 : short nPosition,
43 : WinBits nWinStyle)
44 : :OSQLNameEdit(pParent, nWinStyle, _rAllowedChars)
45 0 : ,m_nPos(nPosition)
46 : {
47 0 : m_strHelpText = ModuleRes(nHelpId);
48 0 : }
49 :
50 : void
51 0 : OPropColumnEditCtrl::SetSpecialReadOnly(sal_Bool _bReadOnly)
52 : {
53 0 : SetReadOnly(_bReadOnly);
54 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
55 0 : }
56 :
57 :
58 :
59 0 : OPropEditCtrl::OPropEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
60 : :Edit(pParent, nWinStyle)
61 0 : ,m_nPos(nPosition)
62 : {
63 0 : m_strHelpText = ModuleRes(nHelpId);
64 0 : }
65 :
66 : void
67 0 : OPropEditCtrl::SetSpecialReadOnly(sal_Bool _bReadOnly)
68 : {
69 0 : SetReadOnly(_bReadOnly);
70 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
71 0 : }
72 :
73 : void
74 0 : OPropNumericEditCtrl::SetSpecialReadOnly(sal_Bool _bReadOnly)
75 : {
76 0 : SetReadOnly(_bReadOnly);
77 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
78 0 : }
79 :
80 :
81 0 : OPropNumericEditCtrl::OPropNumericEditCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
82 : :NumericField(pParent, nWinStyle)
83 0 : ,m_nPos(nPosition)
84 : {
85 0 : m_strHelpText = ModuleRes(nHelpId);
86 0 : }
87 :
88 0 : OPropListBoxCtrl::OPropListBoxCtrl(Window* pParent, sal_uInt16 nHelpId, short nPosition, WinBits nWinStyle)
89 : :ListBox(pParent, nWinStyle)
90 0 : ,m_nPos(nPosition)
91 : {
92 0 : m_strHelpText = ModuleRes(nHelpId);
93 0 : }
94 :
95 : void
96 0 : OPropListBoxCtrl::SetSpecialReadOnly(sal_Bool _bReadOnly)
97 : {
98 0 : SetReadOnly(_bReadOnly);
99 0 : lcl_setSpecialReadOnly(_bReadOnly,this);
100 0 : }
101 :
102 : } // end namespace dbaui
|