[Libreoffice-commits] core.git: sc/source sc/uiconfig

Dennis Francis dennis.francis at collabora.co.uk
Tue Dec 19 19:33:51 UTC 2017


 sc/source/ui/inc/tpcalc.hxx              |    2 +
 sc/source/ui/optdlg/tpcalc.cxx           |   13 ++++++
 sc/uiconfig/scalc/ui/optcalculatepage.ui |   59 +++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)

New commits:
commit c7f528bbc8ad70fb869736ea810534e8210284b5
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date:   Tue Dec 19 08:55:46 2017 +0530

    Add UI config option to enable/disable threading
    
    Change-Id: I7a83d80c0db233a48026d1254021b926f28002f3
    Reviewed-on: https://gerrit.libreoffice.org/46782
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx
index 4cb10646da01..3108604820a9 100644
--- a/sc/source/ui/inc/tpcalc.hxx
+++ b/sc/source/ui/inc/tpcalc.hxx
@@ -68,6 +68,8 @@ private:
     VclPtr<FixedText>      m_pFtPrec;
     VclPtr<NumericField>   m_pEdPrec;
 
+    VclPtr<CheckBox>       m_pBtnThread;
+
     ScDocOptions*          pOldOptions;
     ScDocOptions*          pLocalOptions;
     sal_uInt16             nWhichCalc;
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index 541a63096e1b..4ec601a23ac6 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -63,6 +63,7 @@ ScTpCalcOptions::ScTpCalcOptions(vcl::Window* pParent, const SfxItemSet& rCoreAt
     get(m_pBtnGeneralPrec, "generalprec");
     get(m_pFtPrec, "precft");
     get(m_pEdPrec, "prec");
+    get(m_pBtnThread, "threadingenabled");
     Init();
     SetExchangeSupport();
 }
@@ -94,6 +95,7 @@ void ScTpCalcOptions::dispose()
     m_pBtnGeneralPrec.clear();
     m_pFtPrec.clear();
     m_pEdPrec.clear();
+    m_pBtnThread.clear();
     SfxTabPage::dispose();
 }
 
@@ -104,6 +106,7 @@ void ScTpCalcOptions::Init()
     m_pBtnDateStd->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
     m_pBtnDateSc10->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
     m_pBtnDate1904->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
+    m_pBtnThread->SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
 }
 
 VclPtr<SfxTabPage> ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
@@ -180,6 +183,9 @@ void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ )
         m_pEdPrec->SetValue(nPrec);
     }
 
+    m_pBtnThread->Enable();
+    m_pBtnThread->Check( officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get() );
+
     CheckClickHdl(m_pBtnIterate);
 }
 
@@ -200,6 +206,13 @@ bool ScTpCalcOptions::FillItemSet( SfxItemSet* rCoreAttrs )
     else
         pLocalOptions->SetStdPrecision( SvNumberFormatter::UNLIMITED_PRECISION );
 
+    bool bShouldEnableThreading = m_pBtnThread->IsChecked();
+    if (bShouldEnableThreading != officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get())
+    {
+        std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create());
+        officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::set(bShouldEnableThreading, xBatch);
+        xBatch->commit();
+    }
     if ( *pLocalOptions != *pOldOptions )
     {
         rCoreAttrs->Put( ScTpCalcItem( nWhichCalc, *pLocalOptions ) );
diff --git a/sc/uiconfig/scalc/ui/optcalculatepage.ui b/sc/uiconfig/scalc/ui/optcalculatepage.ui
index 14153f079709..7244c1b11637 100644
--- a/sc/uiconfig/scalc/ui/optcalculatepage.ui
+++ b/sc/uiconfig/scalc/ui/optcalculatepage.ui
@@ -23,6 +23,65 @@
     <property name="row_spacing">12</property>
     <property name="column_spacing">18</property>
     <child>
+      <object class="GtkFrame" id="frame4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkGrid" id="grid4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkCheckButton" id="threadingenabled">
+                    <property name="label" translatable="yes" context="optcalculatepage|threadingenabled">Enable multi-threaded calculation</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes" context="optcalculatepage|threadingenabled|tooltip_text">Enable multi-threaded calculation of formula-groups</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">2</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes" context="optcalculatepage|label4">CPU threading settings</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkFrame" id="frame1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>


More information about the Libreoffice-commits mailing list