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 , m_xLbCellsRight(m_xBuilder->weld_label("right"))
36{
37 const ScViewData* pViewData = ScDocShell::GetViewData();
38 if (pViewData && pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo()))
39 m_xLbCellsRight->set_label(ScResId(SCSTR_INSERT_RTL));
40
41 if (bDisallowCellMove)
42 {
43 m_xBtnCellsDown->set_sensitive(false);
44 m_xBtnCellsRight->set_sensitive(false);
45 m_xBtnInsRow->set_active(true);
46
47 switch (nInsItemChecked)
48 {
49 case 2:
50 m_xBtnInsRow->set_active(true);
51 break;
52 case 3:
53 m_xBtnInsCol->set_active(true);
54 break;
55 default:
56 m_xBtnInsRow->set_active(true);
57 break;
58 }
59 }
60 else
61 {
62 switch (nInsItemChecked)
63 {
64 case 0:
65 m_xBtnCellsDown->set_active(true);
66 break;
67 case 1:
68 m_xBtnCellsRight->set_active(true);
69 break;
70 case 2:
71 m_xBtnInsRow->set_active(true);
72 break;
73 case 3:
74 m_xBtnInsCol->set_active(true);
75 break;
76 }
77 }
78}
79
81
83{
84 InsCellCmd nReturn = INS_NONE;
85
86 if (m_xBtnCellsDown->get_active())
87 {
89 nReturn = INS_CELLSDOWN;
90 }
91 else if (m_xBtnCellsRight->get_active())
92 {
94 nReturn = INS_CELLSRIGHT;
95 }
96 else if (m_xBtnInsRow->get_active())
97 {
99 nReturn = INS_INSROWS_BEFORE;
100 }
101 else if (m_xBtnInsCol->get_active())
102 {
103 nInsItemChecked = 3;
104 nReturn = INS_INSCOLS_BEFORE;
105 }
106
107 return nReturn;
108}
109
110/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static ScViewData * GetViewData()
Definition: docsh4.cxx:2592
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:997
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
std::unique_ptr< weld::Label > m_xLbCellsRight
Definition: inscldlg.hxx:33
InsCellCmd GetInsCellCmd() const
Definition: inscldlg.cxx:82
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:80
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
InsCellCmd
Definition: global.hxx:289
@ INS_NONE
Definition: global.hxx:294
@ INS_CELLSDOWN
Definition: global.hxx:290
@ INS_INSCOLS_BEFORE
Definition: global.hxx:293
@ INS_CELLSRIGHT
Definition: global.hxx:291
@ INS_INSROWS_BEFORE
Definition: global.hxx:292
static sal_uInt8 nInsItemChecked
Definition: inscldlg.cxx:27
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
unsigned char sal_uInt8