tdf#160621 Variable field dialog size of value field
[LibreOffice.git] / dbaccess / source / ui / dlg / QueryPropertiesDialog.cxx
blob5bede295c0294d8f941ffe77133685e49f136b27
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include <QueryPropertiesDialog.hxx>
11 #include <strings.hrc>
12 #include <core_resource.hxx>
14 namespace dbaui
17 QueryPropertiesDialog::QueryPropertiesDialog(
18 weld::Window* pParent, const bool bDistinct, const sal_Int64 nLimit )
19 : GenericDialogController(pParent, u"dbaccess/ui/querypropertiesdialog.ui"_ustr, u"QueryPropertiesDialog"_ustr)
20 , m_xRB_Distinct(m_xBuilder->weld_radio_button(u"distinct"_ustr))
21 , m_xRB_NonDistinct(m_xBuilder->weld_radio_button(u"nondistinct"_ustr))
22 , m_xLB_Limit(m_xBuilder->weld_combo_box(u"limitbox"_ustr))
24 m_xRB_Distinct->set_active(bDistinct);
25 m_xRB_NonDistinct->set_active(!bDistinct);
27 m_xLB_Limit->append(OUString::number(-1), DBA_RES(STR_QUERY_LIMIT_ALL)); // ALL_INT and ALL_STRING
28 /// Default values
29 sal_Int64 const aDefLimitAry[] =
32 10,
33 20,
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));
46 sal_Int64 QueryPropertiesDialog::getLimit() const
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();
54 QueryPropertiesDialog::~QueryPropertiesDialog()
58 } ///dbaui namespace
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */