diff options
author | Albert Thuswaldner <albert.thuswaldner@gmail.com> | 2012-02-03 11:15:31 +0100 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-06 13:44:30 -0500 |
commit | 28ff7a37e66c8746a0b176b4ea25e20c1cd135c5 (patch) | |
tree | 1a767aa2587d50ec6f6e3b277b2aa1e11110a492 /sc/source/ui/optdlg/tpcompatibility.cxx | |
parent | ce97851773a06103504972eb2771eecd7dd81e36 (diff) |
Moved ScTpCompat from docoptions to appoptions
Diffstat (limited to 'sc/source/ui/optdlg/tpcompatibility.cxx')
-rw-r--r-- | sc/source/ui/optdlg/tpcompatibility.cxx | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx index fae9106eb2dd..3748fb1fa19d 100644 --- a/sc/source/ui/optdlg/tpcompatibility.cxx +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -29,10 +29,11 @@ #undef SC_DLLIMPLEMENTATION +#include <scmod.hxx> #include "tpcompatibility.hxx" #include "optdlg.hrc" #include "scresid.hxx" -#include "docoptio.hxx" +#include "appoptio.hxx" ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAttrs) : SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs), @@ -41,11 +42,6 @@ ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAtt maLbKeyBindings(this, ScResId(LB_KEY_BINDINGS)) { FreeResource(); - - const ScTpCalcItem& rItem = static_cast<const ScTpCalcItem&>( - rCoreAttrs.Get(GetWhich(SID_SCDOCOPTIONS))); - mpOldOptions.reset(new ScDocOptions(rItem.GetDocOptions())); - mpNewOptions.reset(new ScDocOptions(rItem.GetDocOptions())); } ScTpCompatOptions::~ScTpCompatOptions() @@ -59,43 +55,40 @@ SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAt sal_Bool ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs) { - ScOptionsUtil::KeyBindingType eKeyB = ScOptionsUtil::KEY_DEFAULT; - switch (maLbKeyBindings.GetSelectEntryPos()) - { - case 0: - eKeyB = ScOptionsUtil::KEY_DEFAULT; - break; - case 1: - eKeyB = ScOptionsUtil::KEY_OOO_LEGACY; - break; - default: - ; - } - mpNewOptions->SetKeyBindingType(eKeyB); - - if (*mpNewOptions != *mpOldOptions) + bool bRet = false; + if (maLbKeyBindings.GetSavedValue() != maLbKeyBindings.GetSelectEntryPos()) { - rCoreAttrs.Put(ScTpCalcItem(GetWhich(SID_SCDOCOPTIONS), *mpNewOptions)); - return true; + rCoreAttrs.Put( + SfxUInt16Item( + SID_SC_OPT_KEY_BINDING_COMPAT, maLbKeyBindings.GetSelectEntryPos())); + bRet = true; } - else - return false; + return bRet; } -void ScTpCompatOptions::Reset(const SfxItemSet &/*rCoreAttrs*/) +void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs) { - ScOptionsUtil::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType(); - switch (eKeyB) + const SfxPoolItem* pItem; + if (SFX_ITEM_SET == rCoreAttrs.GetItemState(SID_SC_OPT_KEY_BINDING_COMPAT, false, &pItem)) { - case ScOptionsUtil::KEY_DEFAULT: - maLbKeyBindings.SelectEntryPos(0); - break; - case ScOptionsUtil::KEY_OOO_LEGACY: - maLbKeyBindings.SelectEntryPos(1); - break; - default: - ; + const SfxUInt16Item* p16Item = static_cast<const SfxUInt16Item*>(pItem); + ScOptionsUtil::KeyBindingType eKeyB = + static_cast<ScOptionsUtil::KeyBindingType>(p16Item->GetValue()); + + switch (eKeyB) + { + case ScOptionsUtil::KEY_DEFAULT: + maLbKeyBindings.SelectEntryPos(0); + break; + case ScOptionsUtil::KEY_OOO_LEGACY: + maLbKeyBindings.SelectEntryPos(1); + break; + default: + ; + } } + + maLbKeyBindings.SaveValue(); } int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/) |