Line data Source code
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 <scmod.hxx>
13 : #include "tpcompatibility.hxx"
14 : #include "sc.hrc"
15 : #include "scresid.hxx"
16 : #include "appoptio.hxx"
17 :
18 0 : ScTpCompatOptions::ScTpCompatOptions(vcl::Window *pParent, const SfxItemSet &rCoreAttrs) :
19 0 : SfxTabPage(pParent, "OptCompatibilityPage","modules/scalc/ui/optcompatibilitypage.ui", &rCoreAttrs)
20 : {
21 0 : get(m_pLbKeyBindings,"keybindings");
22 0 : }
23 :
24 0 : ScTpCompatOptions::~ScTpCompatOptions()
25 : {
26 0 : disposeOnce();
27 0 : }
28 :
29 0 : void ScTpCompatOptions::dispose()
30 : {
31 0 : m_pLbKeyBindings.clear();
32 0 : SfxTabPage::dispose();
33 0 : }
34 :
35 0 : VclPtr<SfxTabPage> ScTpCompatOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs)
36 : {
37 0 : return VclPtr<ScTpCompatOptions>::Create(pParent, *rCoreAttrs);
38 : }
39 :
40 0 : bool ScTpCompatOptions::FillItemSet(SfxItemSet *rCoreAttrs)
41 : {
42 0 : bool bRet = false;
43 0 : if (m_pLbKeyBindings->IsValueChangedFromSaved())
44 : {
45 : rCoreAttrs->Put(
46 : SfxUInt16Item(
47 0 : SID_SC_OPT_KEY_BINDING_COMPAT, m_pLbKeyBindings->GetSelectEntryPos()));
48 0 : bRet = true;
49 : }
50 0 : return bRet;
51 : }
52 :
53 0 : void ScTpCompatOptions::Reset(const SfxItemSet *rCoreAttrs)
54 : {
55 : const SfxPoolItem* pItem;
56 0 : if (rCoreAttrs->HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem))
57 : {
58 0 : const SfxUInt16Item* p16Item = static_cast<const SfxUInt16Item*>(pItem);
59 : ScOptionsUtil::KeyBindingType eKeyB =
60 0 : static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue());
61 :
62 0 : switch (eKeyB)
63 : {
64 : case ScOptionsUtil::KEY_DEFAULT:
65 0 : m_pLbKeyBindings->SelectEntryPos(0);
66 0 : break;
67 : case ScOptionsUtil::KEY_OOO_LEGACY:
68 0 : m_pLbKeyBindings->SelectEntryPos(1);
69 0 : break;
70 : default:
71 : ;
72 : }
73 : }
74 :
75 0 : m_pLbKeyBindings->SaveValue();
76 0 : }
77 :
78 0 : SfxTabPage::sfxpg ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
79 : {
80 0 : return KEEP_PAGE;
81 0 : }
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|