[Libreoffice-commits] core.git: offapi/com sc/inc sc/source

Tor Lillqvist tml at collabora.com
Mon Jan 5 12:43:47 PST 2015


 offapi/com/sun/star/sheet/opencl/XOpenCLSelection.idl |   25 ++++++++++
 sc/inc/docuno.hxx                                     |   14 +++++
 sc/source/ui/unoobj/docuno.cxx                        |   45 ++++++++++++++++++
 3 files changed, 84 insertions(+)

New commits:
commit 88fe046c158d5a20f8f9fa14a7d734ea3aaa85be
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Jan 5 20:39:55 2015 +0200

    Extend the Calc UNO API for the conditions whether to use OpenCL for a formula
    
    Setters/getters for the flag whether to restrict OpenCL to formulas that use a
    subset of opcodes, and the lower limit on number of cells a fomula should
    refer to in order for OpenCL to be considered.
    
    Change-Id: Ifeb11d4e4003f13e392fe03f1ce2f89147f46e38

diff --git a/offapi/com/sun/star/sheet/opencl/XOpenCLSelection.idl b/offapi/com/sun/star/sheet/opencl/XOpenCLSelection.idl
index cbf1af0..b7f47b8 100644
--- a/offapi/com/sun/star/sheet/opencl/XOpenCLSelection.idl
+++ b/offapi/com/sun/star/sheet/opencl/XOpenCLSelection.idl
@@ -74,6 +74,31 @@ interface XOpenCLSelection : com::sun::star::uno::XInterface
      */
     sequence< OpenCLPlatform > getOpenCLPlatforms();
 
+    /*
+     * Sets OpenCL to be considered only for formulas that use only a specific subset of opcodes.
+     */
+    void enableOpcodeSubsetTest();
+
+    /*
+     * Sets OpenCL to be considered for formulas regardless of what opcodes they contain.
+     */
+    void disableOpcodeSubsetTest();
+
+    /*
+     * Returns whether OpenCL is considered or not depending on the opcodes a formula uses.
+     */
+    boolean isOpcodeSubsetTested();
+
+    /*
+     * Sets the lower limit on the number of cells involved in a formula for OpenCL to be considered.
+     */
+    void setFormulaCellNumberLimit( [in] long number );
+
+    /*
+     * Returns the lower limit on the number of cells involved in a formula for OpenCL to be considered.
+     */
+    long getFormulaCellNumberLimit();
+
 };
 
 }; }; }; }; };
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index da0ea25..9f7ed0a 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -353,6 +353,20 @@ public:
         SAL_CALL getOpenCLPlatforms()
                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    virtual void SAL_CALL enableOpcodeSubsetTest()
+                                throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual void SAL_CALL disableOpcodeSubsetTest()
+                                throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual sal_Bool SAL_CALL isOpcodeSubsetTested()
+                                throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual void SAL_CALL setFormulaCellNumberLimit( sal_Int32 number )
+                                throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual sal_Int32 SAL_CALL getFormulaCellNumberLimit()
+                                throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     // ITiledRenderable
     virtual void paintTile( VirtualDevice& rDevice,
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6993c04..10f50aa 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -28,6 +28,7 @@
 #include <svx/unoshape.hxx>
 
 #include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Calc.hxx>
 #include <svl/numuno.hxx>
 #include <svl/smplhint.hxx>
 #include <unotools/moduleoptions.hxx>
@@ -2448,6 +2449,50 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
 #endif
 }
 
+namespace {
+
+void setOpcodeSubsetTest(bool bFlag)
+    throw (uno::RuntimeException, std::exception)
+{
+    boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+    officecfg::Office::Calc::Formula::Calculation::OpenCLSubsetOnly::set(bFlag, batch);
+    batch->commit();
+}
+
+}
+
+void ScModelObj::enableOpcodeSubsetTest()
+    throw (uno::RuntimeException, std::exception)
+{
+    setOpcodeSubsetTest(true);
+}
+
+void ScModelObj::disableOpcodeSubsetTest()
+    throw (uno::RuntimeException, std::exception)
+{
+    setOpcodeSubsetTest(false);
+}
+
+sal_Bool ScModelObj::isOpcodeSubsetTested()
+    throw (uno::RuntimeException, std::exception)
+{
+    return officecfg::Office::Calc::Formula::Calculation::OpenCLSubsetOnly::get();
+}
+
+void ScModelObj::setFormulaCellNumberLimit( sal_Int32 number )
+    throw (uno::RuntimeException, std::exception)
+{
+    boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+    officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(number, batch);
+    batch->commit();
+}
+
+sal_Int32 ScModelObj::getFormulaCellNumberLimit()
+    throw (uno::RuntimeException, std::exception)
+{
+    return officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::get().get();
+}
+
 ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) :
     pDocShell( pDocSh )
 {


More information about the Libreoffice-commits mailing list