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 "optdlg.hrc"
15 : #include "scresid.hxx"
16 : #include "appoptio.hxx"
17 :
18 0 : ScTpCompatOptions::ScTpCompatOptions(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 : }
27 :
28 0 : SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAttrs)
29 : {
30 0 : return new ScTpCompatOptions(pParent, rCoreAttrs);
31 : }
32 :
33 0 : bool ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
34 : {
35 0 : bool bRet = false;
36 0 : if (m_pLbKeyBindings->GetSavedValue() != m_pLbKeyBindings->GetSelectEntryPos())
37 : {
38 : rCoreAttrs.Put(
39 : SfxUInt16Item(
40 0 : SID_SC_OPT_KEY_BINDING_COMPAT, m_pLbKeyBindings->GetSelectEntryPos()));
41 0 : bRet = true;
42 : }
43 0 : return bRet;
44 : }
45 :
46 0 : void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs)
47 : {
48 : const SfxPoolItem* pItem;
49 0 : if (rCoreAttrs.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem))
50 : {
51 0 : const SfxUInt16Item* p16Item = static_cast<const SfxUInt16Item*>(pItem);
52 : ScOptionsUtil::KeyBindingType eKeyB =
53 0 : static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue());
54 :
55 0 : switch (eKeyB)
56 : {
57 : case ScOptionsUtil::KEY_DEFAULT:
58 0 : m_pLbKeyBindings->SelectEntryPos(0);
59 0 : break;
60 : case ScOptionsUtil::KEY_OOO_LEGACY:
61 0 : m_pLbKeyBindings->SelectEntryPos(1);
62 0 : break;
63 : default:
64 : ;
65 : }
66 : }
67 :
68 0 : m_pLbKeyBindings->SaveValue();
69 0 : }
70 :
71 0 : int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
72 : {
73 0 : return KEEP_PAGE;
74 0 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|