diff options
author | Eike Rathke <erack@redhat.com> | 2015-08-25 21:16:43 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-08-26 01:41:07 +0200 |
commit | ad1284df599f3493e7c76c7f8b4230aab1946558 (patch) | |
tree | 9d02f5e21543bbbbf2ed392afeda2b1568b2264f | |
parent | 162264450cb62177ea133829d081fecdb02136b5 (diff) |
Resolves: rhbz#1255811 implement Edit modify handler
... and disable/enable Apply/Ok buttons for in/valid ranges.
Change-Id: I52b5eae2f34e3fca7c0761b14124477a0d160b01
-rw-r--r-- | sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/inc/RandomNumberGeneratorDialog.hxx | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index fe7624e05303..c49944920c6d 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -120,6 +120,7 @@ void ScRandomNumberGeneratorDialog::Init() mpInputRangeEdit->SetLoseFocusHdl ( aLink ); mpInputRangeButton->SetLoseFocusHdl ( aLink ); + mpInputRangeEdit->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, InputRangeModified )); mpParameter1Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter1ValueModified )); mpParameter2Value->SetModifyHdl( LINK( this, ScRandomNumberGeneratorDialog, Parameter2ValueModified )); @@ -170,11 +171,17 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange OUString aReferenceString(maInputRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); mpInputRangeEdit->SetRefString( aReferenceString ); + + mpButtonApply->Enable(); + mpButtonOk->Enable(); } } void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers() { + if (!maInputRange.IsValid()) + return; + sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos(); sal_Int64 aSelectedId = reinterpret_cast<sal_Int64>(mpDistributionCombo->GetEntryData(aSelectedIndex)); @@ -357,6 +364,28 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, LoseFocusHandler) 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) { sal_Int16 aSelectedIndex = mpDistributionCombo-> GetSelectEntryPos(); diff --git a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx index 6d791c27c2a4..045a5726b771 100644 --- a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx +++ b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx @@ -76,6 +76,7 @@ private: DECL_LINK( GetFocusHandler, Control* ); DECL_LINK( LoseFocusHandler, void* ); + DECL_LINK( InputRangeModified, void* ); DECL_LINK( Parameter1ValueModified, void* ); DECL_LINK( Parameter2ValueModified, void* ); DECL_LINK( DistributionChanged, void* ); |