tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / miscdlgs / delcldlg.cxx
blob925993c7fb01a2df857f7c807b88e99030775f49
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <delcldlg.hxx>
24 static sal_uInt8 nDelItemChecked = 0;
26 ScDeleteCellDlg::ScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove)
27 : GenericDialogController(pParent, u"modules/scalc/ui/deletecells.ui"_ustr,
28 u"DeleteCellsDialog"_ustr)
29 , m_xBtnCellsUp(m_xBuilder->weld_radio_button(u"up"_ustr))
30 , m_xBtnCellsLeft(m_xBuilder->weld_radio_button(u"left"_ustr))
31 , m_xBtnDelRows(m_xBuilder->weld_radio_button(u"rows"_ustr))
32 , m_xBtnDelCols(m_xBuilder->weld_radio_button(u"cols"_ustr))
34 if (bDisallowCellMove)
36 m_xBtnCellsUp->set_sensitive(false);
37 m_xBtnCellsLeft->set_sensitive(false);
39 switch (nDelItemChecked)
41 case 2:
42 m_xBtnDelRows->set_active(true);
43 break;
44 case 3:
45 m_xBtnDelCols->set_active(true);
46 break;
47 default:
48 m_xBtnDelRows->set_active(true);
49 break;
52 else
54 switch (nDelItemChecked)
56 case 0:
57 m_xBtnCellsUp->set_active(true);
58 break;
59 case 1:
60 m_xBtnCellsLeft->set_active(true);
61 break;
62 case 2:
63 m_xBtnDelRows->set_active(true);
64 break;
65 case 3:
66 m_xBtnDelCols->set_active(true);
67 break;
72 ScDeleteCellDlg::~ScDeleteCellDlg() {}
74 DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
76 DelCellCmd nReturn = DelCellCmd::NONE;
78 if (m_xBtnCellsUp->get_active())
80 nDelItemChecked = 0;
81 nReturn = DelCellCmd::CellsUp;
83 else if (m_xBtnCellsLeft->get_active())
85 nDelItemChecked = 1;
86 nReturn = DelCellCmd::CellsLeft;
88 else if (m_xBtnDelRows->get_active())
90 nDelItemChecked = 2;
91 nReturn = DelCellCmd::Rows;
93 else if (m_xBtnDelCols->get_active())
95 nDelItemChecked = 3;
96 nReturn = DelCellCmd::Cols;
99 return nReturn;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */