[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source

Eike Rathke erack at redhat.com
Wed Oct 7 01:02:02 PDT 2015


 sc/source/ui/optdlg/calcoptionsdlg.cxx |   49 ++++++++++++++++++---------------
 sc/source/ui/optdlg/calcoptionsdlg.hxx |    1 
 2 files changed, 29 insertions(+), 21 deletions(-)

New commits:
commit fb38840771bc4c58de9bd62b960d0f2154fac394
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Oct 6 17:59:38 2015 +0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 13e9487..a4f7e06 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 179b488..a2af6c7 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);


More information about the Libreoffice-commits mailing list