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 : SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs),
20 : maFlKeyBindings(this, ScResId(FL_KEY_BINDINGS)),
21 : maFtKeyBindings(this, ScResId(FT_KEY_BINDINGS)),
22 0 : maLbKeyBindings(this, ScResId(LB_KEY_BINDINGS))
23 : {
24 0 : FreeResource();
25 0 : }
26 :
27 0 : ScTpCompatOptions::~ScTpCompatOptions()
28 : {
29 0 : }
30 :
31 0 : SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAttrs)
32 : {
33 0 : return new ScTpCompatOptions(pParent, rCoreAttrs);
34 : }
35 :
36 0 : sal_Bool ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
37 : {
38 0 : bool bRet = false;
39 0 : if (maLbKeyBindings.GetSavedValue() != maLbKeyBindings.GetSelectEntryPos())
40 : {
41 : rCoreAttrs.Put(
42 : SfxUInt16Item(
43 0 : SID_SC_OPT_KEY_BINDING_COMPAT, maLbKeyBindings.GetSelectEntryPos()));
44 0 : bRet = true;
45 : }
46 0 : return bRet;
47 : }
48 :
49 0 : void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs)
50 : {
51 : const SfxPoolItem* pItem;
52 0 : if (rCoreAttrs.HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem))
53 : {
54 0 : const SfxUInt16Item* p16Item = static_cast<const SfxUInt16Item*>(pItem);
55 : ScOptionsUtil::KeyBindingType eKeyB =
56 0 : static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue());
57 :
58 0 : switch (eKeyB)
59 : {
60 : case ScOptionsUtil::KEY_DEFAULT:
61 0 : maLbKeyBindings.SelectEntryPos(0);
62 0 : break;
63 : case ScOptionsUtil::KEY_OOO_LEGACY:
64 0 : maLbKeyBindings.SelectEntryPos(1);
65 0 : break;
66 : default:
67 : ;
68 : }
69 : }
70 :
71 0 : maLbKeyBindings.SaveValue();
72 0 : }
73 :
74 0 : int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
75 : {
76 0 : return KEEP_PAGE;
77 0 : }
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|