From 33d57704c6d79dbd806caf94124776a6a05152a1 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 30 May 2012 10:03:05 -0400 Subject: Reset the calc settings to default when the 'Default' button is checked. Change-Id: Ia7eda2d9ff29b5997654fef1a01d637f474b06cc --- sc/inc/calcconfig.hxx | 2 ++ sc/source/core/tool/calcconfig.cxx | 5 +++++ sc/source/ui/optdlg/tpformula.cxx | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index 4af6222778dd..7dd52ce80880 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -41,6 +41,8 @@ struct SC_DLLPUBLIC ScCalcConfig ScCalcConfig(); + void reset(); + bool operator== (const ScCalcConfig& r) const; bool operator!= (const ScCalcConfig& r) const; }; diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index e4efbca260df..3f0fd3547adb 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -31,6 +31,11 @@ ScCalcConfig::ScCalcConfig() : meIndirectRefSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED) {} +void ScCalcConfig::reset() +{ + *this = ScCalcConfig(); +} + bool ScCalcConfig::operator== (const ScCalcConfig& r) const { return meIndirectRefSyntax == r.meIndirectRefSyntax; diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 6eb00b994a2c..cb15a0020ac0 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -254,6 +254,12 @@ sal_Bool ScTpFormulaOptions::FillItemSet(SfxItemSet& rCoreSet) OUString aSepArrayCol = maEdSepArrayCol.GetText(); OUString aSepArrayRow = maEdSepArrayRow.GetText(); + if (maBtnCustomCalcDefault.IsChecked()) + { + // When Default is selected, reset all the calc config settings to default. + maCurrentConfig.reset(); + } + if ( maLbFormulaSyntax.GetSavedValue() != aSyntaxPos || maCbEnglishFuncName.GetSavedValue() != bEnglishFuncName || static_cast(maEdSepFuncArg.GetSavedValue()) != aSep -- cgit