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/.
10 #undef SC_DLLIMPLEMENTATION
12 #include <svl/intitem.hxx>
13 #include <svl/eitem.hxx>
15 #include <tpcompatibility.hxx>
17 #include <optutil.hxx>
19 ScTpCompatOptions::ScTpCompatOptions(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rCoreAttrs
)
20 : SfxTabPage(pPage
, pController
, "modules/scalc/ui/optcompatibilitypage.ui", "OptCompatibilityPage", &rCoreAttrs
)
21 , m_xLbKeyBindings(m_xBuilder
->weld_combo_box("keybindings"))
22 , m_xBtnLink(m_xBuilder
->weld_check_button("cellLinkCB"))
26 ScTpCompatOptions::~ScTpCompatOptions()
30 std::unique_ptr
<SfxTabPage
> ScTpCompatOptions::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rCoreAttrs
)
32 return std::make_unique
<ScTpCompatOptions
>(pPage
, pController
, *rCoreAttrs
);
35 bool ScTpCompatOptions::FillItemSet(SfxItemSet
*rCoreAttrs
)
38 if (m_xLbKeyBindings
->get_value_changed_from_saved())
42 SID_SC_OPT_KEY_BINDING_COMPAT
, m_xLbKeyBindings
->get_active()));
45 if (m_xBtnLink
->get_state_changed_from_saved())
47 rCoreAttrs
->Put(SfxBoolItem(SID_SC_OPT_LINKS
, m_xBtnLink
->get_active()));
54 void ScTpCompatOptions::Reset(const SfxItemSet
*rCoreAttrs
)
56 if (const SfxUInt16Item
* p16Item
= rCoreAttrs
->GetItemIfSet(SID_SC_OPT_KEY_BINDING_COMPAT
))
58 ScOptionsUtil::KeyBindingType eKeyB
=
59 static_cast<ScOptionsUtil::KeyBindingType
>(p16Item
->GetValue());
63 case ScOptionsUtil::KEY_DEFAULT
:
64 m_xLbKeyBindings
->set_active(0);
66 case ScOptionsUtil::KEY_OOO_LEGACY
:
67 m_xLbKeyBindings
->set_active(1);
73 m_xLbKeyBindings
->save_value();
75 if (const SfxBoolItem
* pbItem
= rCoreAttrs
->GetItemIfSet(SID_SC_OPT_LINKS
))
77 m_xBtnLink
->set_active(pbItem
->GetValue());
79 m_xBtnLink
->save_state();
82 DeactivateRC
ScTpCompatOptions::DeactivatePage(SfxItemSet
* /*pSet*/)
84 return DeactivateRC::KeepPage
;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */