LibreOffice Module dbaccess (master) 1
QueryPropertiesDialog.cxx
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
11#include <strings.hrc>
12#include <core_resource.hxx>
13
14namespace dbaui
15{
16
18 weld::Window* pParent, const bool bDistinct, const sal_Int64 nLimit )
19 : GenericDialogController(pParent, "dbaccess/ui/querypropertiesdialog.ui", "QueryPropertiesDialog")
20 , m_xRB_Distinct(m_xBuilder->weld_radio_button("distinct"))
21 , m_xRB_NonDistinct(m_xBuilder->weld_radio_button("nondistinct"))
22 , m_xLB_Limit(m_xBuilder->weld_combo_box("limitbox"))
23{
24 m_xRB_Distinct->set_active(bDistinct);
25 m_xRB_NonDistinct->set_active(!bDistinct);
26
27 m_xLB_Limit->append(OUString::number(-1), DBA_RES(STR_QUERY_LIMIT_ALL)); // ALL_INT and ALL_STRING
29 sal_Int64 const aDefLimitAry[] =
30 {
31 5,
32 10,
33 20,
34 50
35 };
36 for (auto a : aDefLimitAry)
37 m_xLB_Limit->append(OUString::number(a), OUString::number(a));
38 OUString sInitial = OUString::number(nLimit);
39 auto nPos = m_xLB_Limit->find_id(sInitial);
40 if (nPos != -1)
41 m_xLB_Limit->set_active(nPos);
42 else
43 m_xLB_Limit->set_entry_text(OUString::number(nLimit));
44}
45
47{
48 OUString sSelectedId = m_xLB_Limit->get_active_id();
49 if (!sSelectedId.isEmpty())
50 return sSelectedId.toInt64();
51 return m_xLB_Limit->get_active_text().toInt64();
52}
53
55{
56}
57
58}
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xLB_Limit
std::unique_ptr< weld::RadioButton > m_xRB_NonDistinct
std::unique_ptr< weld::RadioButton > m_xRB_Distinct
QueryPropertiesDialog(weld::Window *pParent, const bool bDistinct, const sal_Int64 nLimit)
#define DBA_RES(id)
uno_Any a
sal_uInt16 nPos