LibreOffice Module sc (master)  1
sortdlg.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  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #undef SC_DLLIMPLEMENTATION
21 
22 #include <scui_def.hxx>
23 #include <tpsort.hxx>
24 #include <sortdlg.hxx>
25 
26 ScSortDlg::ScSortDlg(weld::Window* pParent, const SfxItemSet* pArgSet)
27  : SfxTabDialogController(pParent, "modules/scalc/ui/sortdialog.ui", "SortDialog", pArgSet)
28 {
29  AddTabPage("criteria", ScTabPageSortFields::Create, nullptr);
30  AddTabPage("options", ScTabPageSortOptions::Create, nullptr);
31 }
32 
34  std::u16string_view rExtendText, std::u16string_view rCurrentText)
35  : GenericDialogController(pParent, "modules/scalc/ui/sortwarning.ui", "SortWarning")
36  , m_xFtText(m_xBuilder->weld_label("sorttext"))
37  , m_xBtnExtSort(m_xBuilder->weld_button("extend"))
38  , m_xBtnCurSort(m_xBuilder->weld_button("current"))
39 {
40  OUString sTextName = m_xFtText->get_label();
41  sTextName = sTextName.replaceFirst("%1", rExtendText);
42  sTextName = sTextName.replaceFirst("%2", rCurrentText);
43  m_xFtText->set_label(sTextName);
44 
45  m_xBtnExtSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
46  m_xBtnCurSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
47 }
48 
50 {
51 }
52 
53 IMPL_LINK(ScSortWarningDlg, BtnHdl, weld::Button&, rBtn, void)
54 {
55  if (&rBtn == m_xBtnExtSort.get())
56  {
57  m_xDialog->response(BTN_EXTEND_RANGE);
58  }
59  else if(&rBtn == m_xBtnCurSort.get())
60  {
62  }
63 }
64 
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Button > m_xBtnCurSort
Definition: sortdlg.hxx:40
#define BTN_EXTEND_RANGE
Definition: scui_def.hxx:65
IMPL_LINK(ScSortWarningDlg, BtnHdl, weld::Button &, rBtn, void)
Definition: sortdlg.cxx:53
#define BTN_CURRENT_SELECTION
Definition: scui_def.hxx:66
ScSortDlg(weld::Window *pParent, const SfxItemSet *pArgSet)
Definition: sortdlg.cxx:26
virtual ~ScSortWarningDlg() override
Definition: sortdlg.cxx:49
std::unique_ptr< weld::Button > m_xBtnExtSort
Definition: sortdlg.hxx:39
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsort.cxx:158
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Label > m_xFtText
Definition: sortdlg.hxx:38
ScSortWarningDlg(weld::Window *pParent, std::u16string_view rExtendText, std::u16string_view rCurrentText)
Definition: sortdlg.cxx:33
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *pArgSet)
Definition: tpsort.cxx:567