Line data Source code
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 : #include "scresid.hxx"
24 : #include "miscdlgs.hrc"
25 :
26 : static sal_uInt8 nDelItemChecked=0;
27 :
28 0 : ScDeleteCellDlg::ScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove)
29 0 : : ModalDialog(pParent, "DeleteCellsDialog", "modules/scalc/ui/deletecells.ui")
30 : {
31 0 : get(m_pBtnCellsUp, "up");
32 0 : get(m_pBtnCellsLeft, "left");
33 0 : get(m_pBtnDelRows, "rows");
34 0 : get(m_pBtnDelCols, "cols");
35 :
36 0 : if (bDisallowCellMove)
37 : {
38 0 : m_pBtnCellsUp->Disable();
39 0 : m_pBtnCellsLeft->Disable();
40 :
41 0 : switch(nDelItemChecked)
42 : {
43 0 : case 2: m_pBtnDelRows->Check();break;
44 0 : case 3: m_pBtnDelCols->Check();break;
45 0 : default:m_pBtnDelRows->Check();break;
46 : }
47 : }
48 : else
49 : {
50 0 : switch(nDelItemChecked)
51 : {
52 0 : case 0: m_pBtnCellsUp->Check();break;
53 0 : case 1: m_pBtnCellsLeft->Check();break;
54 0 : case 2: m_pBtnDelRows->Check();break;
55 0 : case 3: m_pBtnDelCols->Check();break;
56 : }
57 : }
58 0 : }
59 :
60 0 : ScDeleteCellDlg::~ScDeleteCellDlg()
61 : {
62 0 : disposeOnce();
63 0 : }
64 :
65 0 : void ScDeleteCellDlg::dispose()
66 : {
67 0 : m_pBtnCellsUp.clear();
68 0 : m_pBtnCellsLeft.clear();
69 0 : m_pBtnDelRows.clear();
70 0 : m_pBtnDelCols.clear();
71 0 : ModalDialog::dispose();
72 0 : }
73 :
74 :
75 0 : DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
76 : {
77 0 : DelCellCmd nReturn = DEL_NONE;
78 :
79 0 : if ( m_pBtnCellsUp->IsChecked() )
80 : {
81 0 : nDelItemChecked=0;
82 0 : nReturn = DEL_CELLSUP;
83 : }
84 0 : else if ( m_pBtnCellsLeft->IsChecked() )
85 : {
86 0 : nDelItemChecked=1;
87 0 : nReturn = DEL_CELLSLEFT;
88 : }
89 0 : else if ( m_pBtnDelRows->IsChecked() )
90 : {
91 0 : nDelItemChecked=2;
92 0 : nReturn = DEL_DELROWS;
93 : }
94 0 : else if ( m_pBtnDelCols->IsChecked() )
95 : {
96 0 : nDelItemChecked=3;
97 0 : nReturn = DEL_DELCOLS;
98 : }
99 :
100 0 : return nReturn;
101 0 : }
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|