add wildcards to Tools->Options->Calc->Calculate dialog, tdf#72196

Maybe this should be a radio button instead (wildcards/regex/literal),
on the other hand it reflects the two API bool values. Also only two
checkbox lines are needed instead of three radio button lines.

Change-Id: I3fa74e19c838e10dc0cffd6c0ad6329017e10e56
This commit is contained in:
Eike Rathke
2016-02-22 20:43:50 +01:00
parent d098b76f33
commit 20b5917966
3 changed files with 42 additions and 5 deletions

View File

@@ -60,6 +60,7 @@ private:
VclPtr<CheckBox> m_pBtnCase; VclPtr<CheckBox> m_pBtnCase;
VclPtr<CheckBox> m_pBtnCalc; VclPtr<CheckBox> m_pBtnCalc;
VclPtr<CheckBox> m_pBtnMatch; VclPtr<CheckBox> m_pBtnMatch;
VclPtr<CheckBox> m_pBtnWildcards;
VclPtr<CheckBox> m_pBtnRegex; VclPtr<CheckBox> m_pBtnRegex;
VclPtr<CheckBox> m_pBtnLookUp; VclPtr<CheckBox> m_pBtnLookUp;
VclPtr<CheckBox> m_pBtnGeneralPrec; VclPtr<CheckBox> m_pBtnGeneralPrec;

View File

@@ -55,6 +55,7 @@ ScTpCalcOptions::ScTpCalcOptions(vcl::Window* pParent, const SfxItemSet& rCoreAt
get(m_pBtnCase, "case"); get(m_pBtnCase, "case");
get(m_pBtnCalc, "calc"); get(m_pBtnCalc, "calc");
get(m_pBtnMatch, "match"); get(m_pBtnMatch, "match");
get(m_pBtnWildcards, "wildcards");
get(m_pBtnRegex, "regex"); get(m_pBtnRegex, "regex");
get(m_pBtnLookUp, "lookup"); get(m_pBtnLookUp, "lookup");
get(m_pBtnGeneralPrec, "generalprec"); get(m_pBtnGeneralPrec, "generalprec");
@@ -84,6 +85,7 @@ void ScTpCalcOptions::dispose()
m_pBtnCase.clear(); m_pBtnCase.clear();
m_pBtnCalc.clear(); m_pBtnCalc.clear();
m_pBtnMatch.clear(); m_pBtnMatch.clear();
m_pBtnWildcards.clear();
m_pBtnRegex.clear(); m_pBtnRegex.clear();
m_pBtnLookUp.clear(); m_pBtnLookUp.clear();
m_pBtnGeneralPrec.clear(); m_pBtnGeneralPrec.clear();
@@ -99,6 +101,8 @@ void ScTpCalcOptions::Init()
m_pBtnDateStd->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) ); m_pBtnDateStd->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
m_pBtnDateSc10->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) ); m_pBtnDateSc10->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
m_pBtnDate1904->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) ); m_pBtnDate1904->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
m_pBtnWildcards->SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
m_pBtnRegex->SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
} }
VclPtr<SfxTabPage> ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) VclPtr<SfxTabPage> ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
@@ -115,7 +119,12 @@ void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ )
m_pBtnCase->Check( !pLocalOptions->IsIgnoreCase() ); m_pBtnCase->Check( !pLocalOptions->IsIgnoreCase() );
m_pBtnCalc->Check( pLocalOptions->IsCalcAsShown() ); m_pBtnCalc->Check( pLocalOptions->IsCalcAsShown() );
m_pBtnMatch->Check( pLocalOptions->IsMatchWholeCell() ); m_pBtnMatch->Check( pLocalOptions->IsMatchWholeCell() );
m_pBtnRegex->Check( pLocalOptions->IsFormulaRegexEnabled() ); bool bWildcards = pLocalOptions->IsFormulaWildcardsEnabled();
bool bRegex = pLocalOptions->IsFormulaRegexEnabled();
if (bWildcards && bRegex)
bRegex = false;
m_pBtnWildcards->Check( bWildcards );
m_pBtnRegex->Check( bRegex );
m_pBtnLookUp->Check( pLocalOptions->IsLookUpColRowNames() ); m_pBtnLookUp->Check( pLocalOptions->IsLookUpColRowNames() );
m_pBtnIterate->Check( pLocalOptions->IsIter() ); m_pBtnIterate->Check( pLocalOptions->IsIter() );
m_pEdSteps->SetValue( pLocalOptions->GetIterCount() ); m_pEdSteps->SetValue( pLocalOptions->GetIterCount() );
@@ -161,6 +170,7 @@ bool ScTpCalcOptions::FillItemSet( SfxItemSet* rCoreAttrs )
pLocalOptions->SetIgnoreCase( !m_pBtnCase->IsChecked() ); pLocalOptions->SetIgnoreCase( !m_pBtnCase->IsChecked() );
pLocalOptions->SetCalcAsShown( m_pBtnCalc->IsChecked() ); pLocalOptions->SetCalcAsShown( m_pBtnCalc->IsChecked() );
pLocalOptions->SetMatchWholeCell( m_pBtnMatch->IsChecked() ); pLocalOptions->SetMatchWholeCell( m_pBtnMatch->IsChecked() );
pLocalOptions->SetFormulaWildcardsEnabled( m_pBtnWildcards->IsChecked() );
pLocalOptions->SetFormulaRegexEnabled( m_pBtnRegex->IsChecked() ); pLocalOptions->SetFormulaRegexEnabled( m_pBtnRegex->IsChecked() );
pLocalOptions->SetLookUpColRowNames( m_pBtnLookUp->IsChecked() ); pLocalOptions->SetLookUpColRowNames( m_pBtnLookUp->IsChecked() );
@@ -253,6 +263,16 @@ IMPL_LINK_TYPED( ScTpCalcOptions, CheckClickHdl, Button*, p, void )
m_pFtEps->Disable(); m_pEdEps->Disable(); m_pFtEps->Disable(); m_pEdEps->Disable();
} }
} }
else if (pBtn == m_pBtnWildcards)
{
if ( pBtn->IsChecked() )
m_pBtnRegex->Check( false );
}
else if (pBtn == m_pBtnRegex)
{
if ( pBtn->IsChecked() )
m_pBtnWildcards->Check( false );
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -92,8 +92,8 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton" id="regex"> <object class="GtkCheckButton" id="wildcards">
<property name="label" translatable="yes">_Enable regular expressions in formulas</property> <property name="label" translatable="yes">Enable w_ildcards in formulas</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
@@ -107,6 +107,22 @@
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="regex">
<property name="label" translatable="yes">Enable r_egular expressions in formulas</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="lookup"> <object class="GtkCheckButton" id="lookup">
<property name="label" translatable="yes">_Automatically find column and row labels</property> <property name="label" translatable="yes">_Automatically find column and row labels</property>
@@ -119,7 +135,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
@@ -135,7 +151,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">5</property> <property name="top_attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>