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 "inscldlg.hxx"
23 : #include "scresid.hxx"
24 : #include "miscdlgs.hrc"
25 :
26 : static sal_uInt8 nInsItemChecked=0;
27 :
28 0 : ScInsertCellDlg::ScInsertCellDlg( vcl::Window* pParent,bool bDisallowCellMove) :
29 0 : ModalDialog ( pParent, "InsertCellsDialog", "modules/scalc/ui/insertcells.ui")
30 : {
31 0 : get(m_pBtnCellsDown, "down");
32 0 : get(m_pBtnCellsRight, "right");
33 0 : get(m_pBtnInsRow, "rows");
34 0 : get(m_pBtnInsCol, "cols");
35 :
36 0 : if (bDisallowCellMove)
37 : {
38 0 : m_pBtnCellsDown->Disable();
39 0 : m_pBtnCellsRight->Disable();
40 0 : m_pBtnInsRow->Check();
41 :
42 0 : switch(nInsItemChecked)
43 : {
44 0 : case 2: m_pBtnInsRow->Check();break;
45 0 : case 3: m_pBtnInsCol->Check();break;
46 0 : default:m_pBtnInsRow->Check();break;
47 : }
48 : }
49 : else
50 : {
51 0 : switch(nInsItemChecked)
52 : {
53 0 : case 0: m_pBtnCellsDown->Check();break;
54 0 : case 1: m_pBtnCellsRight->Check();break;
55 0 : case 2: m_pBtnInsRow->Check();break;
56 0 : case 3: m_pBtnInsCol->Check();break;
57 : }
58 : }
59 0 : }
60 :
61 0 : ScInsertCellDlg::~ScInsertCellDlg()
62 : {
63 0 : disposeOnce();
64 0 : }
65 :
66 0 : void ScInsertCellDlg::dispose()
67 : {
68 0 : m_pBtnCellsDown.clear();
69 0 : m_pBtnCellsRight.clear();
70 0 : m_pBtnInsRow.clear();
71 0 : m_pBtnInsCol.clear();
72 0 : ModalDialog::dispose();
73 0 : }
74 :
75 0 : InsCellCmd ScInsertCellDlg::GetInsCellCmd() const
76 : {
77 0 : InsCellCmd nReturn = INS_NONE;
78 :
79 0 : if ( m_pBtnCellsDown->IsChecked() )
80 : {
81 0 : nInsItemChecked=0;
82 0 : nReturn = INS_CELLSDOWN;
83 : }
84 0 : else if ( m_pBtnCellsRight->IsChecked())
85 : {
86 0 : nInsItemChecked=1;
87 0 : nReturn = INS_CELLSRIGHT;
88 : }
89 0 : else if ( m_pBtnInsRow->IsChecked() )
90 : {
91 0 : nInsItemChecked=2;
92 0 : nReturn = INS_INSROWS_BEFORE;
93 : }
94 0 : else if ( m_pBtnInsCol->IsChecked() )
95 : {
96 0 : nInsItemChecked=3;
97 0 : nReturn = INS_INSCOLS_BEFORE;
98 : }
99 :
100 0 : return nReturn;
101 0 : }
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|