summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-29 22:33:09 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-30 11:37:20 -0400
commitbebc0e4286edefc20e31b554bccb867274e82a5c (patch)
treec8de45abcb11d577d869246193a494b9f6a29a42 /sc
parent682a81352f6ce9d743ca73c02df5c36b0c6f1253 (diff)
Update the buttons for calc settings on various events.
Change-Id: Icd9de3b714da29df95912ff27b25223c306f1962
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/formulaopt.cxx5
-rw-r--r--sc/source/ui/inc/tpformula.hxx3
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx30
3 files changed, 35 insertions, 3 deletions
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index a49899166c20..bc706dca0958 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -55,6 +55,7 @@ ScFormulaOptions::ScFormulaOptions()
ScFormulaOptions::ScFormulaOptions( const ScFormulaOptions& rCpy ) :
bUseEnglishFuncName ( rCpy.bUseEnglishFuncName ),
eFormulaGrammar ( rCpy.eFormulaGrammar ),
+ eIndirectFuncRefSyntax(rCpy.eIndirectFuncRefSyntax),
aFormulaSepArg ( rCpy.aFormulaSepArg ),
aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ),
aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol )
@@ -143,6 +144,7 @@ ScFormulaOptions& ScFormulaOptions::operator=( const ScFormulaOptions& rCpy )
{
bUseEnglishFuncName = rCpy.bUseEnglishFuncName;
eFormulaGrammar = rCpy.eFormulaGrammar;
+ eIndirectFuncRefSyntax = rCpy.eIndirectFuncRefSyntax;
aFormulaSepArg = rCpy.aFormulaSepArg;
aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
@@ -153,6 +155,7 @@ bool ScFormulaOptions::operator==( const ScFormulaOptions& rOpt ) const
{
return bUseEnglishFuncName == rOpt.bUseEnglishFuncName
&& eFormulaGrammar == rOpt.eFormulaGrammar
+ && eIndirectFuncRefSyntax == rOpt.eIndirectFuncRefSyntax
&& aFormulaSepArg == rOpt.aFormulaSepArg
&& aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow
&& aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol;
@@ -304,6 +307,7 @@ ScFormulaCfg::ScFormulaCfg() :
if ((pValues[nProp] >>= aSep) && !aSep.isEmpty())
SetFormulaSepArrayCol(aSep);
}
+ break;
case SCFORMULAOPT_INDIRECT_GRAMMAR:
{
// Get default value in case this option is not set.
@@ -337,7 +341,6 @@ ScFormulaCfg::ScFormulaCfg() :
SetIndirectFuncSyntax(eConv);
}
break;
- break;
}
}
}
diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx
index 808e0efa3e09..bf908255b9ed 100644
--- a/sc/source/ui/inc/tpformula.hxx
+++ b/sc/source/ui/inc/tpformula.hxx
@@ -52,12 +52,13 @@ private:
void ResetSeparators();
void OnFocusSeparatorInput(Edit* pEdit);
+ void UpdateCustomCalcRadioButtons(bool bDefault);
void LaunchCustomCalcSettings();
bool IsValidSeparator(const ::rtl::OUString& rSep) const;
bool IsValidSeparatorSet() const;
- DECL_LINK( ButtonHdl, PushButton* );
+ DECL_LINK( ButtonHdl, Button* );
DECL_LINK( SepModifyHdl, Edit* );
DECL_LINK( SepEditOnFocusHdl, Edit* );
diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx
index b75c73953af4..814e3281c8c5 100644
--- a/sc/source/ui/optdlg/tpformula.cxx
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -79,6 +79,8 @@ ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreA
Link aLink = LINK( this, ScTpFormulaOptions, ButtonHdl );
maBtnSepReset.SetClickHdl(aLink);
+ maBtnCustomCalcDefault.SetClickHdl(aLink);
+ maBtnCustomCalcCustom.SetClickHdl(aLink);
maBtnCustomCalcDetails.SetClickHdl(aLink);
aLink = LINK( this, ScTpFormulaOptions, SepModifyHdl );
@@ -121,6 +123,22 @@ void ScTpFormulaOptions::OnFocusSeparatorInput(Edit* pEdit)
maOldSepValue = pEdit->GetText();
}
+void ScTpFormulaOptions::UpdateCustomCalcRadioButtons(bool bDefault)
+{
+ if (bDefault)
+ {
+ maBtnCustomCalcDefault.Check(true);
+ maBtnCustomCalcCustom.Check(false);
+ maBtnCustomCalcDetails.Disable();
+ }
+ else
+ {
+ maBtnCustomCalcDefault.Check(false);
+ maBtnCustomCalcCustom.Check(true);
+ maBtnCustomCalcDetails.Enable();
+ }
+}
+
void ScTpFormulaOptions::LaunchCustomCalcSettings()
{
ScCalcOptionsDialog aDlg(this);
@@ -179,10 +197,14 @@ bool ScTpFormulaOptions::IsValidSeparatorSet() const
return true;
}
-IMPL_LINK( ScTpFormulaOptions, ButtonHdl, PushButton*, pBtn )
+IMPL_LINK( ScTpFormulaOptions, ButtonHdl, Button*, pBtn )
{
if (pBtn == &maBtnSepReset)
ResetSeparators();
+ else if (pBtn == &maBtnCustomCalcDefault)
+ UpdateCustomCalcRadioButtons(true);
+ else if (pBtn == &maBtnCustomCalcCustom)
+ UpdateCustomCalcRadioButtons(false);
else if (pBtn == &maBtnCustomCalcDetails)
LaunchCustomCalcSettings();
@@ -315,6 +337,12 @@ void ScTpFormulaOptions::Reset(const SfxItemSet& rCoreSet)
}
else
ResetSeparators();
+
+ // detailed calc settings.
+ ScFormulaOptions aDefaults;
+ formula::FormulaGrammar::AddressConvention eConv = aOpt.GetIndirectFuncSyntax();
+ bool bDefault = aDefaults.GetIndirectFuncSyntax() == eConv;
+ UpdateCustomCalcRadioButtons(bDefault);
}
int ScTpFormulaOptions::DeactivatePage(SfxItemSet* /*pSet*/)