LibreOffice Module sc (master)  1
delcldlg.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 <delcldlg.hxx>
23 
25 
26 ScDeleteCellDlg::ScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove)
27  : GenericDialogController(pParent, "modules/scalc/ui/deletecells.ui", "DeleteCellsDialog")
28  , m_xBtnCellsUp(m_xBuilder->weld_radio_button("up"))
29  , m_xBtnCellsLeft(m_xBuilder->weld_radio_button("left"))
30  , m_xBtnDelRows(m_xBuilder->weld_radio_button("rows"))
31  , m_xBtnDelCols(m_xBuilder->weld_radio_button("cols"))
32 {
33  if (bDisallowCellMove)
34  {
35  m_xBtnCellsUp->set_sensitive(false);
36  m_xBtnCellsLeft->set_sensitive(false);
37 
38  switch (nDelItemChecked)
39  {
40  case 2:
41  m_xBtnDelRows->set_active(true);
42  break;
43  case 3:
44  m_xBtnDelCols->set_active(true);
45  break;
46  default:
47  m_xBtnDelRows->set_active(true);
48  break;
49  }
50  }
51  else
52  {
53  switch (nDelItemChecked)
54  {
55  case 0:
56  m_xBtnCellsUp->set_active(true);
57  break;
58  case 1:
59  m_xBtnCellsLeft->set_active(true);
60  break;
61  case 2:
62  m_xBtnDelRows->set_active(true);
63  break;
64  case 3:
65  m_xBtnDelCols->set_active(true);
66  break;
67  }
68  }
69 }
70 
72 
74 {
75  DelCellCmd nReturn = DelCellCmd::NONE;
76 
77  if (m_xBtnCellsUp->get_active())
78  {
79  nDelItemChecked = 0;
80  nReturn = DelCellCmd::CellsUp;
81  }
82  else if (m_xBtnCellsLeft->get_active())
83  {
84  nDelItemChecked = 1;
85  nReturn = DelCellCmd::CellsLeft;
86  }
87  else if (m_xBtnDelRows->get_active())
88  {
89  nDelItemChecked = 2;
90  nReturn = DelCellCmd::Rows;
91  }
92  else if (m_xBtnDelCols->get_active())
93  {
94  nDelItemChecked = 3;
95  nReturn = DelCellCmd::Cols;
96  }
97 
98  return nReturn;
99 }
100 
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static sal_uInt8 nDelItemChecked
Definition: delcldlg.cxx:24
ScDeleteCellDlg(weld::Window *pParent, bool bDisallowCellMove)
Definition: delcldlg.cxx:26
std::unique_ptr< weld::RadioButton > m_xBtnDelRows
Definition: delcldlg.hxx:31
std::unique_ptr< weld::RadioButton > m_xBtnCellsUp
Definition: delcldlg.hxx:29
DelCellCmd
Definition: global.hxx:278
std::unique_ptr< weld::RadioButton > m_xBtnCellsLeft
Definition: delcldlg.hxx:30
std::unique_ptr< weld::RadioButton > m_xBtnDelCols
Definition: delcldlg.hxx:32
virtual ~ScDeleteCellDlg() override
Definition: delcldlg.cxx:71
DelCellCmd GetDelCellCmd() const
Definition: delcldlg.cxx:73
unsigned char sal_uInt8