diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-10-12 15:44:56 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-10-12 15:44:56 -0400 |
commit | f7cf0280f9f83eabad93221ea91977bc384ec20a (patch) | |
tree | 9659acc8104c6b6cccc0c051153bde63a747450d /sc/source/ui/optdlg/tpcompatibility.cxx | |
parent | 3ab2280e3f88b75408117948deb385ac146be5d6 (diff) |
Took care of loading and saving of the new option value.
The new option value is now persistent with the Options dialog, but
key bindings don't get reset yet.
Diffstat (limited to 'sc/source/ui/optdlg/tpcompatibility.cxx')
-rw-r--r-- | sc/source/ui/optdlg/tpcompatibility.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx index 7820dc4ad53d..c9853f3c7c4e 100644 --- a/sc/source/ui/optdlg/tpcompatibility.cxx +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -33,6 +33,7 @@ #include "tpcompatibility.hxx" #include "optdlg.hrc" #include "scresid.hxx" +#include "docoptio.hxx" ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAttrs) : SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs), @@ -41,6 +42,11 @@ 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() @@ -54,11 +60,43 @@ SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAt BOOL ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs) { - return false; + ScDocOptions::KeyBindingType eKeyB = ScDocOptions::KEY_DEFAULT; + switch (maLbKeyBindings.GetSelectEntryPos()) + { + case 0: + eKeyB = ScDocOptions::KEY_DEFAULT; + break; + case 1: + eKeyB = ScDocOptions::KEY_OOO_LEGACY; + break; + default: + ; + } + mpNewOptions->SetKeyBindingType(eKeyB); + + if (*mpNewOptions != *mpOldOptions) + { + rCoreAttrs.Put(ScTpCalcItem(GetWhich(SID_SCDOCOPTIONS), *mpNewOptions)); + return true; + } + else + return false; } void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs) { + ScDocOptions::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType(); + switch (eKeyB) + { + case ScDocOptions::KEY_DEFAULT: + maLbKeyBindings.SelectEntryPos(0); + break; + case ScDocOptions::KEY_OOO_LEGACY: + maLbKeyBindings.SelectEntryPos(1); + break; + default: + ; + } } int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/) |