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
14#include <scresid.hxx>
15#include <strings.hrc>
16
18 : m_xBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/sortkey.ui"))
19 , m_xFrame(m_xBuilder->weld_frame("SortKeyFrame"))
20 , m_xLbSort(m_xBuilder->weld_combo_box("sortlb"))
21 , m_xBtnUp(m_xBuilder->weld_radio_button("up"))
22 , m_xBtnDown(m_xBuilder->weld_radio_button("down"))
23 , m_xLabel(m_xBuilder->weld_label("lbColRow"))
24 , m_pParent(pParent)
25{
26 // tdf#136155 let the other elements in the dialog determine the width of the
27 // combobox
28 m_xLbSort->set_size_request(m_xLbSort->get_approximate_digit_width() * 12, -1);
29 // keep the UI static when switching the labels
30 const sal_Int32 nChars = std::max( ScResId(SCSTR_COLUMN).getLength(), ScResId(SCSTR_ROW).getLength() ) + 2; // +2 to avoid cut-off labels on kf5/gen
31 m_xLabel->set_size_request( m_xLabel->get_approximate_digit_width() * nChars, -1);
32}
33
35{
36 m_pParent->move(m_xFrame.get(), nullptr);
37}
38
40{
41 m_xFrame->set_sensitive(false);
42}
43
45{
46 m_xFrame->set_sensitive(true);
47}
48
50 : m_pBox(pBox)
51{
52}
53
55{
56}
57
58void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
59{
60 ScSortKeyItem* pSortKeyItem = new ScSortKeyItem(m_pBox);
61
62 // Set Sort key number
63 OUString aLine = pSortKeyItem->m_xFrame->get_label() +
64 OUString::number( nItemNumber );
65 pSortKeyItem->m_xFrame->set_label(aLine);
66
67 // for ui-testing. Distinguish the sort keys
68 if ( m_aSortKeyItems.size() > 0 )
69 {
70 pSortKeyItem->m_xLbSort->set_buildable_name(
71 pSortKeyItem->m_xLbSort->get_buildable_name() + OString::number(m_aSortKeyItems.size() + 1));
72 }
73
74 m_aSortKeyItems.push_back(std::unique_ptr<ScSortKeyItem>(pSortKeyItem));
75}
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
void AddSortKey(sal_uInt16 nItem)
Definition: sortkeydlg.cxx:58
ScSortKeyWindow(weld::Container *pBox)
Definition: sortkeydlg.cxx:49
weld::Container * m_pBox
Definition: sortkeydlg.hxx:43
ScSortKeyItems m_aSortKeyItems
Definition: sortkeydlg.hxx:40
std::unique_ptr< weld::Label > m_xLabel
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
double getLength(const B2DPolygon &rCandidate)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
std::unique_ptr< weld::Label > m_xLabel
Definition: sortkeydlg.hxx:25
weld::Container * m_pParent
Definition: sortkeydlg.hxx:26
std::unique_ptr< weld::ComboBox > m_xLbSort
Definition: sortkeydlg.hxx:22
std::unique_ptr< weld::Frame > m_xFrame
Definition: sortkeydlg.hxx:21
ScSortKeyItem(weld::Container *pParent)
Definition: sortkeydlg.cxx:17
void EnableField()
Definition: sortkeydlg.cxx:44
void DisableField()
Definition: sortkeydlg.cxx:39