Kaydet (Commit) fb388407 authored tarafından Eike Rathke's avatar Eike Rathke Kaydeden (comit) Caolán McNamara

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 e224c9cb
"Refactor OpenCL settings dialog"

(cherry picked from commit d4bb1ea9)

Conflicts:
	sc/source/ui/optdlg/calcoptionsdlg.cxx

Change-Id: I86f9278e3d7856c70e94c2d1eb9f507359b90899
Reviewed-on: https://gerrit.libreoffice.org/19211Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst b959b6ba
...@@ -97,6 +97,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi ...@@ -97,6 +97,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
get(mpEmptyAsZero,"checkEmptyAsZero"); get(mpEmptyAsZero,"checkEmptyAsZero");
mpEmptyAsZero->Check(rConfig.mbEmptyStringAsZero); mpEmptyAsZero->Check(rConfig.mbEmptyStringAsZero);
mpEmptyAsZero->SetClickHdl(LINK(this, ScCalcOptionsDialog, AsZeroModifiedHdl)); mpEmptyAsZero->SetClickHdl(LINK(this, ScCalcOptionsDialog, AsZeroModifiedHdl));
CoupleEmptyAsZeroToStringConversion();
get(mpSyntax,"comboSyntaxRef"); get(mpSyntax,"comboSyntaxRef");
mpSyntax->SelectEntryPos( toSelectedItem(rConfig.meStringRefAddressSyntax) ); mpSyntax->SelectEntryPos( toSelectedItem(rConfig.meStringRefAddressSyntax) );
...@@ -194,35 +195,41 @@ void ScCalcOptionsDialog::SelectedDeviceChanged() ...@@ -194,35 +195,41 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
#endif #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 ) IMPL_LINK(ScCalcOptionsDialog, AsZeroModifiedHdl, CheckBox*, pCheckBox )
{ {
maConfig.mbEmptyStringAsZero = pCheckBox->IsChecked(); maConfig.mbEmptyStringAsZero = mbSelectedEmptyStringAsZero = pCheckBox->IsChecked();
return 0; return 0;
} }
IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, ListBox*, pConv ) IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, ListBox*, pConv )
{ {
maConfig.meStringConversion = (ScCalcConfig::StringConversion)pConv->GetSelectEntryPos(); maConfig.meStringConversion = (ScCalcConfig::StringConversion)pConv->GetSelectEntryPos();
switch (maConfig.meStringConversion) CoupleEmptyAsZeroToStringConversion();
{
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;
}
return 0; return 0;
} }
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
private: private:
void OpenCLAutomaticSelectionChanged(); void OpenCLAutomaticSelectionChanged();
void SelectedDeviceChanged(); void SelectedDeviceChanged();
void CoupleEmptyAsZeroToStringConversion();
SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const; SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const;
void setValueAt(size_t nPos, const OUString &rString); void setValueAt(size_t nPos, const OUString &rString);
......
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