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
28std::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
46void ScTpCompatOptions::Reset(const SfxItemSet *rCoreAttrs)
47{
48 if (const SfxUInt16Item* p16Item = rCoreAttrs->GetItemIfSet(SID_SC_OPT_KEY_BINDING_COMPAT))
49 {
51 static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue());
52
53 switch (eKeyB)
54 {
56 m_xLbKeyBindings->set_active(0);
57 break;
59 m_xLbKeyBindings->set_active(1);
60 break;
61 default:
62 ;
63 }
64 }
65
66 m_xLbKeyBindings->save_value();
67}
68
70{
71 return DeactivateRC::KeepPage;
72}
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool FillItemSet(SfxItemSet *rCoreAttrs) override
ScTpCompatOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::ComboBox > m_xLbKeyBindings
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreAttrs)
virtual void Reset(const SfxItemSet *rCoreAttrs) override
virtual ~ScTpCompatOptions() override
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
DeactivateRC