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 ) : ScFormulaOptions::ScFormulaOptions( const ScFormulaOptions& rCpy ) :
bUseEnglishFuncName ( rCpy.bUseEnglishFuncName ), bUseEnglishFuncName ( rCpy.bUseEnglishFuncName ),
eFormulaGrammar ( rCpy.eFormulaGrammar ), eFormulaGrammar ( rCpy.eFormulaGrammar ),
eIndirectFuncRefSyntax(rCpy.eIndirectFuncRefSyntax),
aFormulaSepArg ( rCpy.aFormulaSepArg ), aFormulaSepArg ( rCpy.aFormulaSepArg ),
aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ), aFormulaSepArrayRow ( rCpy.aFormulaSepArrayRow ),
aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol ) aFormulaSepArrayCol ( rCpy.aFormulaSepArrayCol )
@@ -143,6 +144,7 @@ ScFormulaOptions& ScFormulaOptions::operator=( const ScFormulaOptions& rCpy )
{ {
bUseEnglishFuncName = rCpy.bUseEnglishFuncName; bUseEnglishFuncName = rCpy.bUseEnglishFuncName;
eFormulaGrammar = rCpy.eFormulaGrammar; eFormulaGrammar = rCpy.eFormulaGrammar;
eIndirectFuncRefSyntax = rCpy.eIndirectFuncRefSyntax;
aFormulaSepArg = rCpy.aFormulaSepArg; aFormulaSepArg = rCpy.aFormulaSepArg;
aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow; aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol; aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
@@ -153,6 +155,7 @@ bool ScFormulaOptions::operator==( const ScFormulaOptions& rOpt ) const
{ {
return bUseEnglishFuncName == rOpt.bUseEnglishFuncName return bUseEnglishFuncName == rOpt.bUseEnglishFuncName
&& eFormulaGrammar == rOpt.eFormulaGrammar && eFormulaGrammar == rOpt.eFormulaGrammar
&& eIndirectFuncRefSyntax == rOpt.eIndirectFuncRefSyntax
&& aFormulaSepArg == rOpt.aFormulaSepArg && aFormulaSepArg == rOpt.aFormulaSepArg
&& aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow && aFormulaSepArrayRow == rOpt.aFormulaSepArrayRow
&& aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol; && aFormulaSepArrayCol == rOpt.aFormulaSepArrayCol;
@@ -304,6 +307,7 @@ ScFormulaCfg::ScFormulaCfg() :
if ((pValues[nProp] >>= aSep) && !aSep.isEmpty()) if ((pValues[nProp] >>= aSep) && !aSep.isEmpty())
SetFormulaSepArrayCol(aSep); SetFormulaSepArrayCol(aSep);
} }
break;
case SCFORMULAOPT_INDIRECT_GRAMMAR: case SCFORMULAOPT_INDIRECT_GRAMMAR:
{ {
// Get default value in case this option is not set. // Get default value in case this option is not set.
@@ -337,7 +341,6 @@ ScFormulaCfg::ScFormulaCfg() :
SetIndirectFuncSyntax(eConv); SetIndirectFuncSyntax(eConv);
} }
break; break;
break;
} }
} }
} }

View File

@@ -52,12 +52,13 @@ private:
void ResetSeparators(); void ResetSeparators();
void OnFocusSeparatorInput(Edit* pEdit); void OnFocusSeparatorInput(Edit* pEdit);
void UpdateCustomCalcRadioButtons(bool bDefault);
void LaunchCustomCalcSettings(); void LaunchCustomCalcSettings();
bool IsValidSeparator(const ::rtl::OUString& rSep) const; bool IsValidSeparator(const ::rtl::OUString& rSep) const;
bool IsValidSeparatorSet() const; bool IsValidSeparatorSet() const;
DECL_LINK( ButtonHdl, PushButton* ); DECL_LINK( ButtonHdl, Button* );
DECL_LINK( SepModifyHdl, Edit* ); DECL_LINK( SepModifyHdl, Edit* );
DECL_LINK( SepEditOnFocusHdl, Edit* ); DECL_LINK( SepEditOnFocusHdl, Edit* );

View File

@@ -79,6 +79,8 @@ ScTpFormulaOptions::ScTpFormulaOptions(Window* pParent, const SfxItemSet& rCoreA
Link aLink = LINK( this, ScTpFormulaOptions, ButtonHdl ); Link aLink = LINK( this, ScTpFormulaOptions, ButtonHdl );
maBtnSepReset.SetClickHdl(aLink); maBtnSepReset.SetClickHdl(aLink);
maBtnCustomCalcDefault.SetClickHdl(aLink);
maBtnCustomCalcCustom.SetClickHdl(aLink);
maBtnCustomCalcDetails.SetClickHdl(aLink); maBtnCustomCalcDetails.SetClickHdl(aLink);
aLink = LINK( this, ScTpFormulaOptions, SepModifyHdl ); aLink = LINK( this, ScTpFormulaOptions, SepModifyHdl );
@@ -121,6 +123,22 @@ void ScTpFormulaOptions::OnFocusSeparatorInput(Edit* pEdit)
maOldSepValue = pEdit->GetText(); 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() void ScTpFormulaOptions::LaunchCustomCalcSettings()
{ {
ScCalcOptionsDialog aDlg(this); ScCalcOptionsDialog aDlg(this);
@@ -179,10 +197,14 @@ bool ScTpFormulaOptions::IsValidSeparatorSet() const
return true; return true;
} }
IMPL_LINK( ScTpFormulaOptions, ButtonHdl, PushButton*, pBtn ) IMPL_LINK( ScTpFormulaOptions, ButtonHdl, Button*, pBtn )
{ {
if (pBtn == &maBtnSepReset) if (pBtn == &maBtnSepReset)
ResetSeparators(); ResetSeparators();
else if (pBtn == &maBtnCustomCalcDefault)
UpdateCustomCalcRadioButtons(true);
else if (pBtn == &maBtnCustomCalcCustom)
UpdateCustomCalcRadioButtons(false);
else if (pBtn == &maBtnCustomCalcDetails) else if (pBtn == &maBtnCustomCalcDetails)
LaunchCustomCalcSettings(); LaunchCustomCalcSettings();
@@ -315,6 +337,12 @@ void ScTpFormulaOptions::Reset(const SfxItemSet& rCoreSet)
} }
else else
ResetSeparators(); ResetSeparators();
// detailed calc settings.
ScFormulaOptions aDefaults;
formula::FormulaGrammar::AddressConvention eConv = aOpt.GetIndirectFuncSyntax();
bool bDefault = aDefaults.GetIndirectFuncSyntax() == eConv;
UpdateCustomCalcRadioButtons(bDefault);
} }
int ScTpFormulaOptions::DeactivatePage(SfxItemSet* /*pSet*/) int ScTpFormulaOptions::DeactivatePage(SfxItemSet* /*pSet*/)