summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-08 14:43:39 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-01-08 14:45:22 -0500
commit4b5a98942cd3ebcdacd4d66fb2bd61211fcfe7bc (patch)
tree700f14e7e0b9a381b7c4223fecd377bed549fb05 /sc
parentd8fd15875901d584a4bbcc07c927fa20332e4841 (diff)
fdo#73408: Make the software interpreter selection stick in the UI.
Change-Id: I136a98fadbde82a7a585df9a5691f884c0362699
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/globalnames.hxx4
-rw-r--r--sc/source/core/tool/formulagroup.cxx3
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx15
3 files changed, 15 insertions, 7 deletions
diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index a7f00530d95c..336bee6688f8 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 4e13ad391fce..8ddafd2093ad 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 93d8010a3886..c23db00d3e2c 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