Update the buttons for calc settings on various events.

Change-Id: Icd9de3b714da29df95912ff27b25223c306f1962
This commit is contained in:
Kohei Yoshida
2012-05-29 22:33:09 -04:00
parent 682a81352f
commit bebc0e4286
3 changed files with 35 additions and 3 deletions

View File

@@ -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;
}
}
}

View File

@@ -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* );

View File

@@ -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*/)