sc/inc/globalnames.hxx                 |    4 ++++
 sc/source/core/tool/formulagroup.cxx   |    3 ++-
 sc/source/ui/optdlg/calcoptionsdlg.cxx |   15 +++++++++------
 3 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 4b5a98942cd3ebcdacd4d66fb2bd61211fcfe7bc
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Wed Jan 8 14:43:39 2014 -0500

    fdo#73408: Make the software interpreter selection stick in the UI.
    
    Change-Id: I136a98fadbde82a7a585df9a5691f884c0362699

diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index a7f0053..336bee6 100644
--- a/sc/inc/globalnames.hxx
+++ b/sc/inc/globalnames.hxx
@@ -23,6 +23,10 @@
 // set (in nScriptType) if type has not been determined yet
 #define SC_SCRIPTTYPE_UNKNOWN 0x08
 
+// Device name used to represent the software group interpreter for OpenCL
+// mode. This string gets stored in use configuration as the device name.
+#define OPENCL_SOFTWARE_DEVICE_CONFIG_NAME "Software"
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/formulagroup.cxx 
b/sc/source/core/tool/formulagroup.cxx
index 4e13ad3..8ddafd2 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -16,6 +16,7 @@
 #include "compiler.hxx"
 #include "interpre.hxx"
 #include "scmatrix.hxx"
+#include "globalnames.hxx"
 
 #include "formula/vectortoken.hxx"
 #include "rtl/bootstrap.hxx"
@@ -599,7 +600,7 @@ void 
FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenclPlatformInfo>& rP
 bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, 
bool bAutoSelect, bool bForceEvaluation)
 {
     bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled;
-    if(!bOpenCLEnabled || rDeviceId == "Software")
+    if (!bOpenCLEnabled || rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)
     {
         if(msInstance)
         {
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx 
b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 93d8010..c23db00 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -16,6 +16,7 @@
 
 #if HAVE_FEATURE_OPENCL
 #include "formulagroup.hxx"
+#include "globalnames.hxx"
 #endif
 
 namespace {
@@ -200,7 +201,7 @@ void ScCalcOptionsDialog::fillOpenclList()
 {
     mpOpenclInfoList->SetUpdateMode(false);
     mpOpenclInfoList->Clear();
-    mpOpenclInfoList->InsertEntry(maSoftware);
+    SvTreeListEntry* pSoftwareEntry = 
mpOpenclInfoList->InsertEntry(maSoftware);
 
     OUString aStoredDevice = maConfig.maOpenCLDevice;
 
@@ -225,10 +226,12 @@ void ScCalcOptionsDialog::fillOpenclList()
 
     mpOpenclInfoList->SetUpdateMode(true);
     mpOpenclInfoList->GetModel()->GetView(0)->SelectAll(false, false);
-    if(pSelectedEntry)
-    {
-        mpOpenclInfoList->GetModel()->GetView(0)->Select(pSelectedEntry);
-    }
+
+    if (pSelectedEntry)
+        mpOpenclInfoList->Select(pSelectedEntry);
+    else if (aStoredDevice == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)
+        mpOpenclInfoList->Select(pSoftwareEntry);
+
     SelectedDeviceChanged();
 }
 
@@ -404,7 +407,7 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
     OUString aDevice = 
dynamic_cast<SvLBoxString*>(pEntry->GetItem(1))->GetText();
     // use english string for configuration
     if(aDevice == maSoftware)
-        aDevice = "Software";
+        aDevice = OPENCL_SOFTWARE_DEVICE_CONFIG_NAME;
 
     maConfig.maOpenCLDevice = aDevice;
 #endif
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to