LibreOffice Module sc (master)  1
tpcompatibility.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #undef SC_DLLIMPLEMENTATION
11 
12 #include <svl/intitem.hxx>
13 
14 #include <tpcompatibility.hxx>
15 #include <sc.hrc>
16 #include <optutil.hxx>
17 
19  : SfxTabPage(pPage, pController, "modules/scalc/ui/optcompatibilitypage.ui", "OptCompatibilityPage", &rCoreAttrs)
20  , m_xLbKeyBindings(m_xBuilder->weld_combo_box("keybindings"))
21 {
22 }
23 
25 {
26 }
27 
28 std::unique_ptr<SfxTabPage> ScTpCompatOptions::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rCoreAttrs)
29 {
30  return std::make_unique<ScTpCompatOptions>(pPage, pController, *rCoreAttrs);
31 }
32 
34 {
35  bool bRet = false;
36  if (m_xLbKeyBindings->get_value_changed_from_saved())
37  {
38  rCoreAttrs->Put(
40  SID_SC_OPT_KEY_BINDING_COMPAT, m_xLbKeyBindings->get_active()));
41  bRet = true;
42  }
43  return bRet;
44 }
45 
46 void ScTpCompatOptions::Reset(const SfxItemSet *rCoreAttrs)
47 {
48  const SfxPoolItem* pItem;
49  if (rCoreAttrs->HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem))
50  {
51  const SfxUInt16Item* p16Item = static_cast<const SfxUInt16Item*>(pItem);
53  static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue());
54 
55  switch (eKeyB)
56  {
58  m_xLbKeyBindings->set_active(0);
59  break;
61  m_xLbKeyBindings->set_active(1);
62  break;
63  default:
64  ;
65  }
66  }
67 
68  m_xLbKeyBindings->save_value();
69 }
70 
72 {
73  return DeactivateRC::KeepPage;
74 }
75 
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetValue() const
std::unique_ptr< weld::ComboBox > m_xLbKeyBindings
ScTpCompatOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual bool FillItemSet(SfxItemSet *rCoreAttrs) override
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual ~ScTpCompatOptions() override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreAttrs)
DeactivateRC
virtual void Reset(const SfxItemSet *rCoreAttrs) override