LibreOffice Module sc (master) 1
inscldlg.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 <inscldlg.hxx>
23#include <viewdata.hxx>
24#include <strings.hrc>
25#include <scresid.hxx>
26
28
29ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove)
30 : GenericDialogController(pParent, "modules/scalc/ui/insertcells.ui", "InsertCellsDialog")
31 , m_xBtnCellsDown(m_xBuilder->weld_radio_button("down"))
32 , m_xBtnCellsRight(m_xBuilder->weld_radio_button("right"))
33 , m_xBtnInsRow(m_xBuilder->weld_radio_button("rows"))
34 , m_xBtnInsCol(m_xBuilder->weld_radio_button("cols"))
35{
36 const ScViewData* pViewData = ScDocShell::GetViewData();
37 if (pViewData && pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo()))
38 m_xBtnCellsRight->set_label(ScResId(SCSTR_INSERT_RTL));
39
40 if (bDisallowCellMove)
41 {
42 m_xBtnCellsDown->set_sensitive(false);
43 m_xBtnCellsRight->set_sensitive(false);
44 m_xBtnInsRow->set_active(true);
45
46 switch (nInsItemChecked)
47 {
48 case 2:
49 m_xBtnInsRow->set_active(true);
50 break;
51 case 3:
52 m_xBtnInsCol->set_active(true);
53 break;
54 default:
55 m_xBtnInsRow->set_active(true);
56 break;
57 }
58 }
59 else
60 {
61 switch (nInsItemChecked)
62 {
63 case 0:
64 m_xBtnCellsDown->set_active(true);
65 break;
66 case 1:
67 m_xBtnCellsRight->set_active(true);
68 break;
69 case 2:
70 m_xBtnInsRow->set_active(true);
71 break;
72 case 3:
73 m_xBtnInsCol->set_active(true);
74 break;
75 }
76 }
77}
78
80
82{
83 InsCellCmd nReturn = INS_NONE;
84
85 if (m_xBtnCellsDown->get_active())
86 {
88 nReturn = INS_CELLSDOWN;
89 }
90 else if (m_xBtnCellsRight->get_active())
91 {
93 nReturn = INS_CELLSRIGHT;
94 }
95 else if (m_xBtnInsRow->get_active())
96 {
98 nReturn = INS_INSROWS_BEFORE;
99 }
100 else if (m_xBtnInsCol->get_active())
101 {
102 nInsItemChecked = 3;
103 nReturn = INS_INSCOLS_BEFORE;
104 }
105
106 return nReturn;
107}
108
109/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static ScViewData * GetViewData()
Definition: docsh4.cxx:2607
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:974
std::unique_ptr< weld::RadioButton > m_xBtnCellsRight
Definition: inscldlg.hxx:30
ScInsertCellDlg(weld::Window *pParent, bool bDisallowCellMove)
Definition: inscldlg.cxx:29
std::unique_ptr< weld::RadioButton > m_xBtnInsCol
Definition: inscldlg.hxx:32
InsCellCmd GetInsCellCmd() const
Definition: inscldlg.cxx:81
std::unique_ptr< weld::RadioButton > m_xBtnCellsDown
Definition: inscldlg.hxx:29
std::unique_ptr< weld::RadioButton > m_xBtnInsRow
Definition: inscldlg.hxx:31
virtual ~ScInsertCellDlg() override
Definition: inscldlg.cxx:79
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
InsCellCmd
Definition: global.hxx:290
@ INS_NONE
Definition: global.hxx:295
@ INS_CELLSDOWN
Definition: global.hxx:291
@ INS_INSCOLS_BEFORE
Definition: global.hxx:294
@ INS_CELLSRIGHT
Definition: global.hxx:292
@ INS_INSROWS_BEFORE
Definition: global.hxx:293
static sal_uInt8 nInsItemChecked
Definition: inscldlg.cxx:27
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
unsigned char sal_uInt8