calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / source / ui / miscdlgs / inscldlg.cxx
blobe077724f42641f4bc561b37ec7c632072820a977
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include <inscldlg.hxx>
23 #include <viewdata.hxx>
24 #include <strings.hrc>
25 #include <scresid.hxx>
27 static sal_uInt8 nInsItemChecked = 0;
29 ScInsertCellDlg::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"))
36 const ScViewData* pViewData = ScDocShell::GetViewData();
37 if (pViewData && pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo()))
38 m_xBtnCellsRight->set_label(ScResId(SCSTR_INSERT_RTL));
40 if (bDisallowCellMove)
42 m_xBtnCellsDown->set_sensitive(false);
43 m_xBtnCellsRight->set_sensitive(false);
44 m_xBtnInsRow->set_active(true);
46 switch (nInsItemChecked)
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;
59 else
61 switch (nInsItemChecked)
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;
79 ScInsertCellDlg::~ScInsertCellDlg() {}
81 InsCellCmd ScInsertCellDlg::GetInsCellCmd() const
83 InsCellCmd nReturn = INS_NONE;
85 if (m_xBtnCellsDown->get_active())
87 nInsItemChecked = 0;
88 nReturn = INS_CELLSDOWN;
90 else if (m_xBtnCellsRight->get_active())
92 nInsItemChecked = 1;
93 nReturn = INS_CELLSRIGHT;
95 else if (m_xBtnInsRow->get_active())
97 nInsItemChecked = 2;
98 nReturn = INS_INSROWS_BEFORE;
100 else if (m_xBtnInsCol->get_active())
102 nInsItemChecked = 3;
103 nReturn = INS_INSCOLS_BEFORE;
106 return nReturn;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */