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/.
11 #include <mergecellsdialog.hxx>
13 static ScMergeCellsOption lastUsedMergeCellsOption
= KeepContentHiddenCells
;
15 ScMergeCellsDialog::ScMergeCellsDialog(weld::Window
* pParent
)
16 : GenericDialogController(pParent
, u
"modules/scalc/ui/mergecellsdialog.ui"_ustr
,
17 u
"MergeCellsDialog"_ustr
)
18 , m_xRBMoveContent(m_xBuilder
->weld_radio_button(u
"move-cells-radio"_ustr
))
19 , m_xRBKeepContent(m_xBuilder
->weld_radio_button(u
"keep-content-radio"_ustr
))
20 , m_xRBEmptyContent(m_xBuilder
->weld_radio_button(u
"empty-cells-radio"_ustr
))
22 if (lastUsedMergeCellsOption
== MoveContentHiddenCells
)
24 m_xRBMoveContent
->set_active(true);
26 else if (lastUsedMergeCellsOption
== KeepContentHiddenCells
)
28 m_xRBKeepContent
->set_active(true);
30 else if (lastUsedMergeCellsOption
== EmptyContentHiddenCells
)
32 m_xRBEmptyContent
->set_active(true);
36 ScMergeCellsDialog::~ScMergeCellsDialog() {}
38 ScMergeCellsOption
ScMergeCellsDialog::GetMergeCellsOption() const
40 if (m_xRBMoveContent
->get_active())
42 lastUsedMergeCellsOption
= MoveContentHiddenCells
;
43 return MoveContentHiddenCells
;
45 else if (m_xRBKeepContent
->get_active())
47 lastUsedMergeCellsOption
= KeepContentHiddenCells
;
48 return KeepContentHiddenCells
;
50 else if (m_xRBEmptyContent
->get_active())
52 lastUsedMergeCellsOption
= EmptyContentHiddenCells
;
53 return EmptyContentHiddenCells
;
55 assert(!"Unknown selection for merge cells.");
56 return KeepContentHiddenCells
; // default value
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */