LibreOffice Module dbaccess (master) 1
FieldControls.hxx
Go to the documentation of this file.
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#pragma once
20
21#include "SqlNameEdit.hxx"
22#include <unotools/resmgr.hxx>
23
24namespace dbaui
25{
26
28 {
29 short m_nPos;
30 OUString m_strHelpText;
31 public:
32 OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, TranslateId pHelpId, short nPosition);
33
34 short GetPos() const { return m_nPos; }
35 const OUString& GetHelp() const { return m_strHelpText; }
36 };
37
39 {
40 std::unique_ptr<weld::Entry> m_xEntry;
41 short m_nPos;
42 OUString m_strHelpText;
43
44 public:
45 OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition);
46
47 void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
48 OUString get_text() const { return m_xEntry->get_text(); }
49 void set_editable(bool bEditable) { m_xEntry->set_editable(bEditable); }
50
51 virtual void save_value() override { m_xEntry->save_value(); }
52 virtual bool get_value_changed_from_saved() const override { return m_xEntry->get_value_changed_from_saved(); }
53
54 short GetPos() const { return m_nPos; }
55 const OUString& GetHelp() const { return m_strHelpText; }
56 };
57
59 {
60 std::unique_ptr<weld::SpinButton> m_xSpinButton;
61 short m_nPos;
62 OUString m_strHelpText;
63
64 public:
65 OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition);
66
67 void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
68 OUString get_text() const { return m_xSpinButton->get_text(); }
69
70 virtual void save_value() override { m_xSpinButton->save_value(); }
71 virtual bool get_value_changed_from_saved() const override { return m_xSpinButton->get_value_changed_from_saved(); }
72 void set_digits(int nLen) { m_xSpinButton->set_digits(nLen); }
73 void set_min(int nMin) { m_xSpinButton->set_min(nMin); }
74 void set_max(int nMax) { m_xSpinButton->set_max(nMax); }
75 void set_range(int nMin, int nMax) { m_xSpinButton->set_range(nMin, nMax); }
76 int get_value() const { return m_xSpinButton->get_value(); }
77
78 short GetPos() const { return m_nPos; }
79 const OUString& GetHelp() const { return m_strHelpText; }
80
81 void set_editable(bool bEditable) { m_xSpinButton->set_editable(bEditable); }
82 };
83
85 {
86 std::unique_ptr<weld::ComboBox> m_xComboBox;
87 short m_nPos;
88 OUString m_strHelpText;
89
90 public:
91 OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition);
92 virtual ~OPropListBoxCtrl() override
93 {
94 m_xComboBox->clear();
95 }
96
97 virtual void save_value() override { m_xComboBox->save_value(); }
98 virtual bool get_value_changed_from_saved() const override { return m_xComboBox->get_value_changed_from_saved(); }
99
101
102 OUString get_active_text() const { return m_xComboBox->get_active_text(); }
103 void set_active_text(const OUString &rText) { m_xComboBox->set_active_text(rText); }
104
105 int get_active() const { return m_xComboBox->get_active(); }
106 void set_active(int nPos) { m_xComboBox->set_active(nPos); }
107
108 int get_count() const { return m_xComboBox->get_count(); }
109
110 void append_text(const OUString &rText) { m_xComboBox->append_text(rText); }
111 void remove_text(const OUString &rText) { m_xComboBox->remove_text(rText); }
112 int find_text(const OUString &rText) const { return m_xComboBox->find_text(rText); }
113
114 short GetPos() const { return m_nPos; }
115 const OUString& GetHelp() const { return m_strHelpText; }
116 };
117
118}
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OPropColumnEditCtrl(std::unique_ptr< weld::Entry > xEntry, OUString const &_rAllowedChars, TranslateId pHelpId, short nPosition)
const OUString & GetHelp() const
void set_text(const OUString &rText)
OPropEditCtrl(std::unique_ptr< weld::Entry > xEntry, TranslateId pHelpId, short nPosition)
virtual bool get_value_changed_from_saved() const override
short GetPos() const
OUString get_text() const
virtual void save_value() override
std::unique_ptr< weld::Entry > m_xEntry
void set_editable(bool bEditable)
const OUString & GetHelp() const
void append_text(const OUString &rText)
OPropListBoxCtrl(std::unique_ptr< weld::ComboBox > xComboBox, TranslateId pHelpId, short nPosition)
std::unique_ptr< weld::ComboBox > m_xComboBox
weld::ComboBox & GetComboBox()
virtual bool get_value_changed_from_saved() const override
int find_text(const OUString &rText) const
OUString get_active_text() const
void set_active_text(const OUString &rText)
virtual void save_value() override
void remove_text(const OUString &rText)
virtual ~OPropListBoxCtrl() override
const OUString & GetHelp() const
std::unique_ptr< weld::SpinButton > m_xSpinButton
void set_text(const OUString &rText)
const OUString & GetHelp() const
void set_range(int nMin, int nMax)
void set_editable(bool bEditable)
virtual bool get_value_changed_from_saved() const override
virtual void save_value() override
OPropNumericEditCtrl(std::unique_ptr< weld::SpinButton > xSpinButton, TranslateId pHelpId, short nPosition)
sal_uInt16 nPos