1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <QueryPropertiesDialog.hxx>
11 #include <strings.hrc>
12 #include <core_resource.hxx>
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
29 sal_Int64
const aDefLimitAry
[] =
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
);
41 m_xLB_Limit
->set_active(nPos
);
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()
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */