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 
ScSortDlg(weld::Window * pParent,const SfxItemSet * pArgSet)26 ScSortDlg::ScSortDlg(weld::Window* pParent, const SfxItemSet* pArgSet)
27     : SfxTabDialogController(pParent, "modules/scalc/ui/sortdialog.ui", "SortDialog", pArgSet)
28     , bIsHeaders(false)
29     , bIsByRows(false)
30 {
31     AddTabPage("criteria", ScTabPageSortFields::Create, nullptr);
32     AddTabPage("options", ScTabPageSortOptions::Create, nullptr);
33 }
34 
ScSortWarningDlg(weld::Window * pParent,const OUString & rExtendText,const OUString & rCurrentText)35 ScSortWarningDlg::ScSortWarningDlg(weld::Window* pParent,
36     const OUString& rExtendText, const OUString& rCurrentText)
37     : GenericDialogController(pParent, "modules/scalc/ui/sortwarning.ui", "SortWarning")
38     , m_xFtText(m_xBuilder->weld_label("sorttext"))
39     , m_xBtnExtSort(m_xBuilder->weld_button("extend"))
40     , m_xBtnCurSort(m_xBuilder->weld_button("current"))
41 {
42     OUString sTextName = m_xFtText->get_label();
43     sTextName = sTextName.replaceFirst("%1", rExtendText);
44     sTextName = sTextName.replaceFirst("%2", rCurrentText);
45     m_xFtText->set_label(sTextName);
46 
47     m_xBtnExtSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
48     m_xBtnCurSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
49 }
50 
~ScSortWarningDlg()51 ScSortWarningDlg::~ScSortWarningDlg()
52 {
53 }
54 
IMPL_LINK(ScSortWarningDlg,BtnHdl,weld::Button &,rBtn,void)55 IMPL_LINK(ScSortWarningDlg, BtnHdl, weld::Button&, rBtn, void)
56 {
57     if (&rBtn == m_xBtnExtSort.get())
58     {
59         m_xDialog->response(BTN_EXTEND_RANGE);
60     }
61     else if(&rBtn == m_xBtnCurSort.get())
62     {
63         m_xDialog->response(BTN_CURRENT_SELECTION);
64     }
65 }
66 
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
68