[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Jan 8 21:00:18 PST 2014


 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 ea38aead924caeae9d51dec5246fef27f4fa456e
Author: Kohei Yoshida <kohei.yoshida at 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
    (cherry picked from commit 4b5a98942cd3ebcdacd4d66fb2bd61211fcfe7bc)
    Reviewed-on: https://gerrit.libreoffice.org/7323
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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 ab60336..f58f7dc 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"
@@ -593,7 +594,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 eefb7f6..79ca879 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


More information about the Libreoffice-commits mailing list