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