LibreOffice Module sc (master)  1
sortkeydlg.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 
10 #include <memory>
11 #include <sortkeydlg.hxx>
12 #include <vcl/svapp.hxx>
13 
15  : m_xBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/sortkey.ui"))
16  , m_xFrame(m_xBuilder->weld_frame("SortKeyFrame"))
17  , m_xLbSort(m_xBuilder->weld_combo_box("sortlb"))
18  , m_xBtnUp(m_xBuilder->weld_radio_button("up"))
19  , m_xBtnDown(m_xBuilder->weld_radio_button("down"))
20  , m_pParent(pParent)
21 {
22  // tdf#136155 let the other elements in the dialog determine the width of the
23  // combobox
24  m_xLbSort->set_size_request(m_xLbSort->get_approximate_digit_width() * 12, -1);
25 }
26 
28 {
29  m_pParent->move(m_xFrame.get(), nullptr);
30 }
31 
33 {
34  m_xFrame->set_sensitive(false);
35 }
36 
38 {
39  m_xFrame->set_sensitive(true);
40 }
41 
43  : m_pBox(pBox)
44 {
45 }
46 
48 {
49 }
50 
51 void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
52 {
53  ScSortKeyItem* pSortKeyItem = new ScSortKeyItem(m_pBox);
54 
55  // Set Sort key number
56  OUString aLine = pSortKeyItem->m_xFrame->get_label() +
57  OUString::number( nItemNumber );
58  pSortKeyItem->m_xFrame->set_label(aLine);
59 
60  // for ui-testing. Distinguish the sort keys
61  if ( m_aSortKeyItems.size() > 0 )
62  {
63  pSortKeyItem->m_xLbSort->set_buildable_name(
64  pSortKeyItem->m_xLbSort->get_buildable_name() + OString::number(m_aSortKeyItems.size() + 1));
65  }
66 
67  m_aSortKeyItems.push_back(std::unique_ptr<ScSortKeyItem>(pSortKeyItem));
68 }
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
ScSortKeyItem(weld::Container *pParent)
Definition: sortkeydlg.cxx:14
weld::Container * m_pBox
Definition: sortkeydlg.hxx:42
std::unique_ptr< weld::Frame > m_xFrame
Definition: sortkeydlg.hxx:21
ScSortKeyWindow(weld::Container *pBox)
Definition: sortkeydlg.cxx:42
void EnableField()
Definition: sortkeydlg.cxx:37
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
std::unique_ptr< weld::ComboBox > m_xLbSort
Definition: sortkeydlg.hxx:22
void AddSortKey(sal_uInt16 nItem)
Definition: sortkeydlg.cxx:51
ScSortKeyItems m_aSortKeyItems
Definition: sortkeydlg.hxx:39
weld::Container * m_pParent
Definition: sortkeydlg.hxx:25
void DisableField()
Definition: sortkeydlg.cxx:32