disable edit field for min and max type, fdo#51834

Change-Id: Id77c58f333bfab5446cf96d24cd9ccfc18802862
This commit is contained in:
Markus Mohrhard 2012-07-16 04:21:40 +02:00
parent e11c88d999
commit b85a2af72e
2 changed files with 41 additions and 0 deletions

View file

@ -173,6 +173,10 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc):
SwitchToType(COLLAPSED);
SetHeight();
SetCondType();
EntryTypeHdl(&maLbEntryTypeMin);
EntryTypeHdl(&maLbEntryTypeMiddle);
EntryTypeHdl(&maLbEntryTypeMax);
}
ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc, const ScFormatEntry* pFormatEntry):
@ -297,6 +301,10 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc, const ScForm
maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl );
SwitchToType(COLLAPSED);
SetHeight();
EntryTypeHdl(&maLbEntryTypeMin);
EntryTypeHdl(&maLbEntryTypeMiddle);
EntryTypeHdl(&maLbEntryTypeMax);
}
ScCondFrmtEntry::~ScCondFrmtEntry()
@ -307,6 +315,12 @@ void ScCondFrmtEntry::Init()
{
maLbType.SetSelectHdl( LINK( this, ScCondFrmtEntry, TypeListHdl ) );
maLbColorFormat.SetSelectHdl( LINK( this, ScCondFrmtEntry, ColFormatTypeHdl ) );
maLbEntryTypeMin.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) );
maLbEntryTypeMax.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) );
maLbEntryTypeMiddle.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) );
SfxStyleSheetIterator aStyleIter( mpDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
{
@ -813,6 +827,31 @@ IMPL_LINK_NOARG(ScCondFrmtEntry, ColFormatTypeHdl)
return 0;
}
IMPL_LINK( ScCondFrmtEntry, EntryTypeHdl, ListBox*, pBox )
{
bool bEnableEdit = true;
sal_Int32 nPos = pBox->GetSelectEntryPos();
if(nPos == 0 || nPos == 1)
{
bEnableEdit = false;
}
Edit* pEd = NULL;
if(pBox == &maLbEntryTypeMin)
pEd = &maEdMin;
else if(pBox == &maLbEntryTypeMiddle)
pEd = &maEdMiddle;
else if(pBox == &maLbEntryTypeMax)
pEd = &maEdMax;
if(bEnableEdit)
pEd->Enable();
else
pEd->Disable();
return 0;
}
IMPL_LINK_NOARG(ScCondFrmtEntry, StyleSelectHdl)
{
if(maLbStyle.GetSelectEntryPos() == 0)
@ -906,6 +945,7 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl )
{
maEdVal2.Hide();
}
return 0;
}

View file

@ -124,6 +124,7 @@ private:
DECL_LINK( OptionBtnHdl, void* );
DECL_LINK( DataBarTypeSelectHdl, void* );
DECL_LINK( ConditionTypeSelectHdl, void* );
DECL_LINK( EntryTypeHdl, ListBox* );
public:
ScCondFrmtEntry( Window* pParent, ScDocument* pDoc );