calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / source / ui / optdlg / tpcompatibility.cxx
bloba9333e3153ad5e77223fe2c87031256d4b2d6705
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/.
8 */
10 #undef SC_DLLIMPLEMENTATION
12 #include <svl/intitem.hxx>
13 #include <svl/eitem.hxx>
15 #include <tpcompatibility.hxx>
16 #include <sc.hrc>
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)
37 bool bRet = false;
38 if (m_xLbKeyBindings->get_value_changed_from_saved())
40 rCoreAttrs->Put(
41 SfxUInt16Item(
42 SID_SC_OPT_KEY_BINDING_COMPAT, m_xLbKeyBindings->get_active()));
43 bRet = true;
45 if (m_xBtnLink->get_state_changed_from_saved())
47 rCoreAttrs->Put(SfxBoolItem(SID_SC_OPT_LINKS, m_xBtnLink->get_active()));
48 bRet = true;
51 return bRet;
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());
61 switch (eKeyB)
63 case ScOptionsUtil::KEY_DEFAULT:
64 m_xLbKeyBindings->set_active(0);
65 break;
66 case ScOptionsUtil::KEY_OOO_LEGACY:
67 m_xLbKeyBindings->set_active(1);
68 break;
69 default:
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: */