Kaydet (Commit) ad1284df authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: rhbz#1255811 implement Edit modify handler

... and disable/enable Apply/Ok buttons for in/valid ranges.

Change-Id: I52b5eae2f34e3fca7c0761b14124477a0d160b01
üst 16226445
...@@ -120,6 +120,7 @@ void ScRandomNumberGeneratorDialog::Init() ...@@ -120,6 +120,7 @@ void ScRandomNumberGeneratorDialog::Init()
mpInputRangeEdit->SetLoseFocusHdl ( aLink ); mpInputRangeEdit->SetLoseFocusHdl ( aLink );
mpInputRangeButton->SetLoseFocusHdl ( aLink ); mpInputRangeButton->SetLoseFocusHdl ( aLink );
mpInputRangeEdit->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, InputRangeModified ));
mpParameter1Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter1ValueModified )); mpParameter1Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter1ValueModified ));
mpParameter2Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter2ValueModified )); mpParameter2Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter2ValueModified ));
...@@ -170,11 +171,17 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange ...@@ -170,11 +171,17 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange
OUString aReferenceString(maInputRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); OUString aReferenceString(maInputRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
mpInputRangeEdit->SetRefString( aReferenceString ); mpInputRangeEdit->SetRefString( aReferenceString );
mpButtonApply->Enable();
mpButtonOk->Enable();
} }
} }
void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers() void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
{ {
if (!maInputRange.IsValid())
return;
sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos(); sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos();
sal_Int64 aSelectedId = reinterpret_cast<sal_Int64>(mpDistributionCombo->GetEntryData(aSelectedIndex)); sal_Int64 aSelectedId = reinterpret_cast<sal_Int64>(mpDistributionCombo->GetEntryData(aSelectedIndex));
...@@ -357,6 +364,28 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, LoseFocusHandler) ...@@ -357,6 +364,28 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, LoseFocusHandler)
return 0; return 0;
} }
IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, InputRangeModified)
{
ScRangeList aRangeList;
bool bValid = ParseWithNames( aRangeList, mpInputRangeEdit->GetText(), mpDoc);
const ScRange* pRange = (bValid && aRangeList.size() == 1) ? aRangeList[0] : nullptr;
if (pRange)
{
maInputRange = *pRange;
mpButtonApply->Enable();
mpButtonOk->Enable();
// Highlight the resulting range.
mpInputRangeEdit->StartUpdateData();
}
else
{
maInputRange = ScRange( ScAddress::INITIALIZE_INVALID);
mpButtonApply->Disable();
mpButtonOk->Disable();
}
return 0;
}
IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, Parameter1ValueModified) IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, Parameter1ValueModified)
{ {
sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos(); sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos();
......
...@@ -76,6 +76,7 @@ private: ...@@ -76,6 +76,7 @@ private:
DECL_LINK( GetFocusHandler, Control* ); DECL_LINK( GetFocusHandler, Control* );
DECL_LINK( LoseFocusHandler, void* ); DECL_LINK( LoseFocusHandler, void* );
DECL_LINK( InputRangeModified, void* );
DECL_LINK( Parameter1ValueModified, void* ); DECL_LINK( Parameter1ValueModified, void* );
DECL_LINK( Parameter2ValueModified, void* ); DECL_LINK( Parameter2ValueModified, void* );
DECL_LINK( DistributionChanged, void* ); DECL_LINK( DistributionChanged, void* );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment