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_xLabel(m_xBuilder->weld_label("lbColRow"))
21  , m_pParent(pParent)
22 {
23  // tdf#136155 let the other elements in the dialog determine the width of the
24  // combobox
25  m_xLbSort->set_size_request(m_xLbSort->get_approximate_digit_width() * 12, -1);
26 }
27 
29 {
30  m_pParent->move(m_xFrame.get(), nullptr);
31 }
32 
34 {
35  m_xFrame->set_sensitive(false);
36 }
37 
39 {
40  m_xFrame->set_sensitive(true);
41 }
42 
44  : m_pBox(pBox)
45 {
46 }
47 
49 {
50 }
51 
52 void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
53 {
54  ScSortKeyItem* pSortKeyItem = new ScSortKeyItem(m_pBox);
55 
56  // Set Sort key number
57  OUString aLine = pSortKeyItem->m_xFrame->get_label() +
58  OUString::number( nItemNumber );
59  pSortKeyItem->m_xFrame->set_label(aLine);
60 
61  // for ui-testing. Distinguish the sort keys
62  if ( m_aSortKeyItems.size() > 0 )
63  {
64  pSortKeyItem->m_xLbSort->set_buildable_name(
65  pSortKeyItem->m_xLbSort->get_buildable_name() + OString::number(m_aSortKeyItems.size() + 1));
66  }
67 
68  m_aSortKeyItems.push_back(std::unique_ptr<ScSortKeyItem>(pSortKeyItem));
69 }
70 
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
std::unique_ptr< weld::Label > m_xLabel
ScSortKeyItem(weld::Container *pParent)
Definition: sortkeydlg.cxx:14
weld::Container * m_pBox
Definition: sortkeydlg.hxx:43
std::unique_ptr< weld::Frame > m_xFrame
Definition: sortkeydlg.hxx:21
ScSortKeyWindow(weld::Container *pBox)
Definition: sortkeydlg.cxx:43
void EnableField()
Definition: sortkeydlg.cxx:38
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:52
ScSortKeyItems m_aSortKeyItems
Definition: sortkeydlg.hxx:40
weld::Container * m_pParent
Definition: sortkeydlg.hxx:26
void DisableField()
Definition: sortkeydlg.cxx:33