diff options
author | Eike Rathke <erack@redhat.com> | 2015-10-06 17:59:38 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-07 08:01:34 +0000 |
commit | fb38840771bc4c58de9bd62b960d0f2154fac394 (patch) | |
tree | ce3aca64027d5ff3b9bdd9bb7d87ba12e4d1aa0c /sc | |
parent | b959b6ba7c3a7385e353ea2fa617b82e177960a0 (diff) |
reintroduce initial coupling of EmptyStringAsZero to StringConversion
... as not all combinations make sense and aren't handled.
For ILLEGAL and ZERO string conversions the EmptyAsZero checkbox is to
be disabled. Also, remember the EmptyAsZero value again if the user
toggled it.
Got lost in commit e224c9cb929cd744674b5d4d265cfb4680c82a2b
"Refactor OpenCL settings dialog"
(cherry picked from commit d4bb1ea98640c0cf575f8ac556b22cdc6f83ba0d)
Conflicts:
sc/source/ui/optdlg/calcoptionsdlg.cxx
Change-Id: I86f9278e3d7856c70e94c2d1eb9f507359b90899
Reviewed-on: https://gerrit.libreoffice.org/19211
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.cxx | 49 | ||||
-rw-r--r-- | sc/source/ui/optdlg/calcoptionsdlg.hxx | 1 |
2 files changed, 29 insertions, 21 deletions
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 13e948722a07..a4f7e0652732 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -97,6 +97,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi get(mpEmptyAsZero,"checkEmptyAsZero"); mpEmptyAsZero->Check(rConfig.mbEmptyStringAsZero); mpEmptyAsZero->SetClickHdl(LINK(this, ScCalcOptionsDialog, AsZeroModifiedHdl)); + CoupleEmptyAsZeroToStringConversion(); get(mpSyntax,"comboSyntaxRef"); mpSyntax->SelectEntryPos( toSelectedItem(rConfig.meStringRefAddressSyntax) ); @@ -194,35 +195,41 @@ void ScCalcOptionsDialog::SelectedDeviceChanged() #endif } +void ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion() +{ + switch (maConfig.meStringConversion) + { + case ScCalcConfig::StringConversion::ILLEGAL: + maConfig.mbEmptyStringAsZero = false; + mpEmptyAsZero->Check(false); + mpEmptyAsZero->Enable(false); + break; + case ScCalcConfig::StringConversion::ZERO: + maConfig.mbEmptyStringAsZero = true; + mpEmptyAsZero->Check(); + mpEmptyAsZero->Enable(false); + break; + case ScCalcConfig::StringConversion::UNAMBIGUOUS: + case ScCalcConfig::StringConversion::LOCALE: + // Reset to the value the user selected before. + maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero; + mpEmptyAsZero->Enable(true); + mpEmptyAsZero->Check( mbSelectedEmptyStringAsZero); + break; + } +} + IMPL_LINK(ScCalcOptionsDialog, AsZeroModifiedHdl, CheckBox*, pCheckBox ) { - maConfig.mbEmptyStringAsZero = pCheckBox->IsChecked(); + maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero = pCheckBox->IsChecked(); return 0; } IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, ListBox*, pConv ) { - maConfig.meStringConversion = (ScCalcConfig::StringConversion)pConv->GetSelectEntryPos(); - switch (maConfig.meStringConversion) - { - case ScCalcConfig::StringConversion::ILLEGAL: - maConfig.mbEmptyStringAsZero = false; - mpEmptyAsZero->Check(false); - mpEmptyAsZero->Enable(false); - break; - case ScCalcConfig::StringConversion::ZERO: - maConfig.mbEmptyStringAsZero = true; - mpEmptyAsZero->Check(true); - mpEmptyAsZero->Enable(false); - break; - case ScCalcConfig::StringConversion::UNAMBIGUOUS: - case ScCalcConfig::StringConversion::LOCALE: - // Reset to the value the user selected before. - maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero; - mpEmptyAsZero->Enable(true); - break; - } + maConfig.meStringConversion = (ScCalcConfig::StringConversion)pConv->GetSelectEntryPos(); + CoupleEmptyAsZeroToStringConversion(); return 0; } diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 179b48819bc1..a2af6c723c79 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -54,6 +54,7 @@ public: private: void OpenCLAutomaticSelectionChanged(); void SelectedDeviceChanged(); + void CoupleEmptyAsZeroToStringConversion(); SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const; void setValueAt(size_t nPos, const OUString &rString); |