1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include <scui_def.hxx>
24 #include <sortdlg.hxx>
25 #include <unotools/viewoptions.hxx>
27 ScSortDlg::ScSortDlg(weld::Window
* pParent
, const SfxItemSet
* pArgSet
)
28 : SfxTabDialogController(pParent
, u
"modules/scalc/ui/sortdialog.ui"_ustr
, u
"SortDialog"_ustr
, pArgSet
)
30 AddTabPage(u
"criteria"_ustr
, ScTabPageSortFields::Create
, nullptr);
31 AddTabPage(u
"options"_ustr
, ScTabPageSortOptions::Create
, nullptr);
33 // restore dialog size
34 SvtViewOptions
aDlgOpt(EViewType::Dialog
, u
"SortDialog"_ustr
);
36 m_xDialog
->set_window_state(aDlgOpt
.GetWindowState());
39 ScSortDlg::~ScSortDlg()
41 // tdf#153852 - Make of sort dialog resizable (and remember size)
42 SvtViewOptions
aDlgOpt(EViewType::Dialog
, u
"SortDialog"_ustr
);
43 OUString sWindowState
= m_xDialog
->get_window_state(vcl::WindowDataMask::PosSize
);
44 aDlgOpt
.SetWindowState(sWindowState
);
47 ScSortWarningDlg::ScSortWarningDlg(weld::Window
* pParent
,
48 std::u16string_view rExtendText
, std::u16string_view rCurrentText
)
49 : GenericDialogController(pParent
, u
"modules/scalc/ui/sortwarning.ui"_ustr
, u
"SortWarning"_ustr
)
50 , m_xFtText(m_xBuilder
->weld_label(u
"sorttext"_ustr
))
51 , m_xBtnExtSort(m_xBuilder
->weld_button(u
"extend"_ustr
))
52 , m_xBtnCurSort(m_xBuilder
->weld_button(u
"current"_ustr
))
54 OUString sTextName
= m_xFtText
->get_label();
55 sTextName
= sTextName
.replaceFirst("%1", rExtendText
);
56 sTextName
= sTextName
.replaceFirst("%2", rCurrentText
);
57 m_xFtText
->set_label(sTextName
);
59 m_xBtnExtSort
->connect_clicked( LINK( this, ScSortWarningDlg
, BtnHdl
) );
60 m_xBtnCurSort
->connect_clicked( LINK( this, ScSortWarningDlg
, BtnHdl
) );
63 ScSortWarningDlg::~ScSortWarningDlg()
67 IMPL_LINK(ScSortWarningDlg
, BtnHdl
, weld::Button
&, rBtn
, void)
69 if (&rBtn
== m_xBtnExtSort
.get())
71 m_xDialog
->response(BTN_EXTEND_RANGE
);
73 else if(&rBtn
== m_xBtnCurSort
.get())
75 m_xDialog
->response(BTN_CURRENT_SELECTION
);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */