summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-22 20:27:48 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-25 20:44:58 +0100
commit7524119f965c54b863c9a67a19ff0a212c77879f (patch)
tree9f4b8bff25ea684f524a7ea8ddb9a9eead921a4a /sc/source/ui
parenteff099b9083ed5a5f83b45162d45c55e5c6d714a (diff)
provide UNO API for OpenCL selection
Change-Id: If5eb71e9298cefdac3dda98cb1ff67fe913ad3c3
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx56
1 files changed, 56 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a1312aaa2045..c1671c6389e2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -92,6 +92,9 @@
#include "sheetevents.hxx"
#include "sc.hrc"
#include "scresid.hxx"
+#include "platforminfo.hxx"
+#include "interpre.hxx"
+#include "formulagroup.hxx"
using namespace com::sun::star;
@@ -2286,6 +2289,59 @@ void ScModelObj::HandleCalculateEvents()
}
}
+// XOpenCLSelection
+
+sal_Bool ScModelObj::isOpenCLEnabled()
+ throw (uno::RuntimeException)
+{
+ return ScInterpreter::GetGlobalConfig().mbOpenCLEnabled;
+}
+
+void ScModelObj::enableOpenCL(sal_Bool bEnable)
+ throw (uno::RuntimeException)
+{
+ ScCalcConfig aConfig = ScInterpreter::GetGlobalConfig();
+ aConfig.mbOpenCLEnabled = bEnable;
+ ScInterpreter::SetGlobalConfig(aConfig);
+}
+
+void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
+ throw (uno::RuntimeException)
+{
+ if(nPlatform < 0 || nDevice < 0)
+ throw uno::RuntimeException();
+
+ std::vector<sc::OpenclPlatformInfo> aPlatformInfo;
+ sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
+ if(size_t(nPlatform) >= aPlatformInfo.size())
+ throw uno::RuntimeException();
+
+ if(size_t(nDevice) >= aPlatformInfo[nPlatform].maDevices.size())
+ throw uno::RuntimeException();
+
+ OUString aDeviceString = aPlatformInfo[nPlatform].maVendor + " " + aPlatformInfo[nPlatform].maDevices[nDevice].maName;
+ sc::FormulaGroupInterpreter::switchOpenCLDevice(aDeviceString, false);
+}
+
+sal_Int32 ScModelObj::getPlatformID()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nPlatformId;
+ sal_Int32 nDeviceId;
+ sc::FormulaGroupInterpreter::getOpenCLDeviceInfo(nDeviceId, nPlatformId);
+ return nPlatformId;
+}
+
+sal_Int32 ScModelObj::getDeviceID()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nPlatformId;
+ sal_Int32 nDeviceId;
+ sc::FormulaGroupInterpreter::getOpenCLDeviceInfo(nDeviceId, nPlatformId);
+ return nDeviceId;
+}
+
+
//------------------------------------------------------------------------
ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) :