1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
)
49 m_xBtnInsRow
->set_active(true);
52 m_xBtnInsCol
->set_active(true);
55 m_xBtnInsRow
->set_active(true);
61 switch (nInsItemChecked
)
64 m_xBtnCellsDown
->set_active(true);
67 m_xBtnCellsRight
->set_active(true);
70 m_xBtnInsRow
->set_active(true);
73 m_xBtnInsCol
->set_active(true);
79 ScInsertCellDlg::~ScInsertCellDlg() {}
81 InsCellCmd
ScInsertCellDlg::GetInsCellCmd() const
83 InsCellCmd nReturn
= INS_NONE
;
85 if (m_xBtnCellsDown
->get_active())
88 nReturn
= INS_CELLSDOWN
;
90 else if (m_xBtnCellsRight
->get_active())
93 nReturn
= INS_CELLSRIGHT
;
95 else if (m_xBtnInsRow
->get_active())
98 nReturn
= INS_INSROWS_BEFORE
;
100 else if (m_xBtnInsCol
->get_active())
103 nReturn
= INS_INSCOLS_BEFORE
;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */