sc/source/ui/optdlg/calcoptionsdlg.cxx | 674 ---------------------- sc/source/ui/optdlg/calcoptionsdlg.hxx | 20 sc/uiconfig/scalc/ui/formulacalculationoptions.ui | 299 --------- sc/uiconfig/scalc/ui/optformula.ui | 2 4 files changed, 1 insertion(+), 994 deletions(-)
New commits: commit 70258bb2d637319d8ff1d19bf304f813c5b2e948 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Jul 27 11:59:32 2016 +0300 Drop OpenCL details from the 'Detailed Calculation Settings' dialog There is really no need for end-users to have access to these settings. We don't want end-users to shoot themselves in the foot. If power users really think they need to modify these settings, they can poke the LibreOffice registry. Change-Id: I567506f2d2adf3c3b1817ca82be808af4e9698f7 diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index a3aac8f..20a7788 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -99,20 +99,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi get(mpCurrentDocOnly,"current_doc"); mpCurrentDocOnly->Check(!mbWriteConfig); mpCurrentDocOnly->SetClickHdl(LINK(this, ScCalcOptionsDialog, CurrentDocOnlyHdl)); - - get(mpUseOpenCL,"CBUseOpenCL"); - mpUseOpenCL->Check(rConfig.mbOpenCLSubsetOnly); - mpUseOpenCL->SetClickHdl(LINK(this, ScCalcOptionsDialog, CBUseOpenCLHdl)); - - get(mpSpinButton,"spinOpenCLSize"); - mpSpinButton->SetValue(rConfig.mnOpenCLMinimumFormulaGroupSize); - mpSpinButton->SetModifyHdl(LINK(this, ScCalcOptionsDialog, SpinOpenCLMinSizeHdl)); - - get(mpEditField, "entry"); - mpEditField->SetText(ScOpCodeSetToSymbolicString(maConfig.mpOpenCLSubsetOpCodes)); - mpEditField->set_height_request(4 * mpEditField->GetTextHeight()); - - mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); } ScCalcOptionsDialog::~ScCalcOptionsDialog() @@ -126,9 +112,6 @@ void ScCalcOptionsDialog::dispose() mpConversion.clear(); mpSyntax.clear(); mpCurrentDocOnly.clear(); - mpUseOpenCL.clear(); - mpSpinButton.clear(); - mpEditField.clear(); ModalDialog::dispose(); } @@ -177,19 +160,4 @@ IMPL_LINK_TYPED(ScCalcOptionsDialog, CurrentDocOnlyHdl, Button*, pCheckBox, void mbWriteConfig = !(static_cast<CheckBox*>(pCheckBox)->IsChecked()); } -IMPL_LINK_TYPED(ScCalcOptionsDialog, CBUseOpenCLHdl, Button*, pCheckBox, void) -{ - maConfig.mbOpenCLSubsetOnly = static_cast<CheckBox*>(pCheckBox)->IsChecked(); -} - -IMPL_LINK_TYPED(ScCalcOptionsDialog, SpinOpenCLMinSizeHdl, Edit&, rEdit, void) -{ - maConfig.mnOpenCLMinimumFormulaGroupSize = static_cast<NumericField&>(rEdit).GetValue(); -} - -IMPL_LINK_TYPED(ScCalcOptionsDialog, EditModifiedHdl, Edit&, rCtrl, void) -{ - maConfig.mpOpenCLSubsetOpCodes = ScStringToOpCodeSet(rCtrl.GetText()); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 317f793..a2bf8c2 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -39,13 +39,10 @@ public: virtual void dispose() override; DECL_LINK_TYPED( BtnAutomaticSelectHdl, RadioButton&, void ); - DECL_LINK_TYPED( EditModifiedHdl, Edit&, void ); DECL_LINK_TYPED( AsZeroModifiedHdl, Button*, void); DECL_LINK_TYPED( ConversionModifiedHdl, ListBox&, void); DECL_LINK_TYPED( SyntaxModifiedHdl, ListBox&, void); DECL_LINK_TYPED( CurrentDocOnlyHdl, Button*, void); - DECL_LINK_TYPED( CBUseOpenCLHdl, Button*, void); - DECL_LINK_TYPED( SpinOpenCLMinSizeHdl, Edit&, void); const ScCalcConfig& GetConfig() const { return maConfig;} bool GetWriteCalcConfig() const { return mbWriteConfig;} @@ -61,10 +58,6 @@ private: VclPtr<ListBox> mpSyntax; VclPtr<CheckBox> mpCurrentDocOnly; - VclPtr<CheckBox> mpUseOpenCL; - VclPtr<NumericField> mpSpinButton; - VclPtr<VclMultiLineEdit> mpEditField; - ScCalcConfig maConfig; bool mbSelectedEmptyStringAsZero; diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui index d748f7d..ffeda70 100644 --- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui +++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui @@ -203,121 +203,6 @@ <property name="position">0</property> </packing> </child> - <child> - <object class="GtkFrame" id="frame2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> - <child> - <object class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="grid1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkCheckButton" id="CBUseOpenCL"> - <property name="label" translatable="yes">Use Open_CL only for a subset of operations</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</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> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Minimum data size for OpenCL use:</property> - <property name="ellipsize">end</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="spinOpenCLSize"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="vexpand">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Subset of OpCodes for which OpenCL is used:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkTextView" id="entry"> - <property name="width_request">60</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="margin_left">50</property> - <property name="wrap_mode">word-char</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">2</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </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">OpenCL Settings</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> </object> </child> <action-widgets> @@ -329,7 +214,6 @@ <widgets> <widget name="comboSyntaxRef"/> <widget name="comboConversion"/> - <widget name="spinOpenCLSize"/> </widgets> </object> </interface> diff --git a/sc/uiconfig/scalc/ui/optformula.ui b/sc/uiconfig/scalc/ui/optformula.ui index 4e66f81..686fbd0 100644 --- a/sc/uiconfig/scalc/ui/optformula.ui +++ b/sc/uiconfig/scalc/ui/optformula.ui @@ -269,7 +269,7 @@ <property name="column_spacing">12</property> <child> <object class="GtkRadioButton" id="calccustom"> - <property name="label" translatable="yes">Custom (use OpenCL, conversion of text to numbers, and more):</property> + <property name="label" translatable="yes">Custom (conversion of text to numbers and more):</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> commit d78012872a15cdd0347cbabfc13e03ce5511bf90 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Jul 27 11:14:24 2016 +0300 tdf#101063: Get rid of the whole "Test OpenCL" functionality while at it Its intended use case has never been particularly clear. (I wrote it, so I know.) We now test OpenCL usability silently at each from-scratch start. Change-Id: I4e04ae5876153f61089ece6a75ebfdecf4cfcc09 diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 2d91a79..a3aac8f 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -83,8 +83,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi , mbSelectedEmptyStringAsZero(rConfig.mbEmptyStringAsZero) , mbWriteConfig(bWriteConfig) { - get(mpTestButton, "test"); - get(mpConversion,"comboConversion"); mpConversion->SelectEntryPos(static_cast<sal_Int32>(rConfig.meStringConversion)); mpConversion->SetSelectHdl(LINK(this, ScCalcOptionsDialog, ConversionModifiedHdl)); @@ -115,8 +113,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi mpEditField->set_height_request(4 * mpEditField->GetTextHeight()); mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); - - mpTestButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, TestClickHdl)); } ScCalcOptionsDialog::~ScCalcOptionsDialog() @@ -133,7 +129,6 @@ void ScCalcOptionsDialog::dispose() mpUseOpenCL.clear(); mpSpinButton.clear(); mpEditField.clear(); - mpTestButton.clear(); ModalDialog::dispose(); } @@ -197,566 +192,4 @@ IMPL_LINK_TYPED(ScCalcOptionsDialog, EditModifiedHdl, Edit&, rCtrl, void) maConfig.mpOpenCLSubsetOpCodes = ScStringToOpCodeSet(rCtrl.GetText()); } -namespace { - -struct Area -{ - OUString msTitle; - int mnRows; - - Area(const OUString& rTitle, int nRows = ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize + 2) : - msTitle(rTitle), - mnRows(nRows) - { - } - - virtual ~Area() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const = 0; - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const = 0; - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const = 0; -}; - -struct OpenCLTester -{ - int mnTestAreas; - ScDocShell* mpDocShell; - ScDocument *mpDoc; - bool mbOldAutoCalc; - ScCalcConfig mpOldCalcConfig; - - OpenCLTester() : - mnTestAreas(0) - { - css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - css::uno::Reference< css::frame::XDesktop2 > xComponentLoader = css::frame::Desktop::create(xContext); - css::uno::Reference< css::lang::XComponent > - xComponent( xComponentLoader->loadComponentFromURL( "private:factory/scalc", - "_blank", 0, - css::uno::Sequence < css::beans::PropertyValue >() ) ); - mpDocShell = dynamic_cast<ScDocShell*>(SfxObjectShell::GetShellFromComponent(xComponent)); - - assert(mpDocShell); - - mpDoc = &mpDocShell->GetDocument(); - - mbOldAutoCalc = mpDoc->GetAutoCalc(); - mpDoc->SetAutoCalc(false); - mpOldCalcConfig = ScInterpreter::GetGlobalConfig(); - ScCalcConfig aConfig(mpOldCalcConfig); - aConfig.mnOpenCLMinimumFormulaGroupSize = 20; - ScInterpreter::SetGlobalConfig(aConfig); - - mpDoc->SetString(ScAddress(0,0,0), "Result:"); - } - - void addTest(const Area &rArea) - { - mnTestAreas++; - (void) mpDocShell->GetDocFunc().InsertTable(mnTestAreas, rArea.msTitle, false, true); - - rArea.addHeader(mpDoc, mnTestAreas); - - for (int i = 0; i < rArea.mnRows; ++i) - rArea.addRow(mpDoc, i, mnTestAreas); - - mpDoc->SetString(ScAddress(0,1+mnTestAreas-1,0), rArea.msTitle + ":"); - mpDoc->SetString(ScAddress(1,1+mnTestAreas-1,0), rArea.getSummaryFormula(mpDoc, mnTestAreas)); - - mpDoc->SetString(ScAddress(1,0,0), - "=IF(SUM(" + - ScRange(ScAddress(1,1,0), - ScAddress(1,1+mnTestAreas-1,0)).Format(ScRefFlags::VALID|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")=0,\"PASS\",\"FAIL\")"); - } -}; - -struct Op : Area -{ - OUString msOp; - double mnRangeLo; - double mnRangeHi; - double mnEpsilon; - - Op(const OUString& rTitle, - const OUString& rOp, - double nRangeLo, double nRangeHi, - double nEpsilon) : - Area(rTitle), - msOp(rOp), - mnRangeLo(nRangeLo), - mnRangeHi(nRangeHi), - mnEpsilon(nEpsilon) - { - } - - virtual ~Op() - { - } -}; - -struct UnOp : Op -{ - double (*mpFun)(double nArg); - bool (*mpFilterOut)(double nArg); - - UnOp(const OUString& rTitle, - const OUString& rOp, - double nRangeLo, double nRangeHi, - double nEpsilon, - double (*pFun)(double nArg), - bool (*pFilterOut)(double nArg) = nullptr) : - Op(rTitle, rOp, nRangeLo, nRangeHi, nEpsilon), - mpFun(pFun), - mpFilterOut(pFilterOut) - { - } - - virtual ~UnOp() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const override - { - pDoc->SetString(ScAddress(0,0,nTab), "arg"); - pDoc->SetString(ScAddress(1,0,nTab), msOp + "(arg)"); - pDoc->SetString(ScAddress(2,0,nTab), "expected"); - } - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const override - { - double nArg; - - do { - nArg = comphelper::rng::uniform_real_distribution(mnRangeLo, mnRangeHi); - } while (mpFilterOut != nullptr && mpFilterOut(nArg)); - - pDoc->SetValue(ScAddress(0,1+nRow,nTab), nArg); - - pDoc->SetString(ScAddress(1,1+nRow,nTab), - "=" + msOp + "(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + ")"); - - pDoc->SetValue(ScAddress(2,1+nRow,nTab), mpFun(nArg)); - - if (mnEpsilon < 0) - { - // relative epsilon - pDoc->SetString(ScAddress(3,1+nRow,nTab), - "=IF(ABS((" + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")/" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=" + OUString::number(-mnEpsilon) + - ",0,1)"); - } - else - { - // absolute epsilon - pDoc->SetString(ScAddress(3,1+nRow,nTab), - "=IF(ABS(" + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=" + OUString::number(mnEpsilon) + - ",0,1)"); - } - } - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const override - { - return "=SUM(" + - ScRange(ScAddress(3,1,nTab), - ScAddress(3,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) + - ")"; - } -}; - -struct BinOp : Op -{ - double (*mpFun)(double nLhs, double nRhs); - bool (*mpFilterOut)(double nLhs, double nRhs); - - BinOp(const OUString& rTitle, - const OUString& rOp, - double nRangeLo, double nRangeHi, - double nEpsilon, - double (*pFun)(double nLhs, double nRhs), - bool (*pFilterOut)(double nLhs, double nRhs) = nullptr) : - Op(rTitle, rOp, nRangeLo, nRangeHi, nEpsilon), - mpFun(pFun), - mpFilterOut(pFilterOut) - { - } - - virtual ~BinOp() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const override - { - pDoc->SetString(ScAddress(0,0,nTab), "lhs"); - pDoc->SetString(ScAddress(1,0,nTab), "rhs"); - pDoc->SetString(ScAddress(2,0,nTab), "lhs" + msOp + "rhs"); - pDoc->SetString(ScAddress(3,0,nTab), "expected"); - } - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const override - { - double nLhs, nRhs; - - do { - nLhs = comphelper::rng::uniform_real_distribution(mnRangeLo, mnRangeHi); - nRhs = comphelper::rng::uniform_real_distribution(mnRangeLo, mnRangeHi); - } while (mpFilterOut != nullptr && mpFilterOut(nLhs, nRhs)); - - pDoc->SetValue(ScAddress(0,1+nRow,nTab), nLhs); - pDoc->SetValue(ScAddress(1,1+nRow,nTab), nRhs); - - pDoc->SetString(ScAddress(2,1+nRow,nTab), - "=" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - msOp + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID)); - - pDoc->SetValue(ScAddress(3,1+nRow,nTab), mpFun(nLhs, nRhs)); - - pDoc->SetString(ScAddress(4,1+nRow,nTab), - "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=" + OUString::number(mnEpsilon) + - ",0,1)"); - } - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const override - { - return "=SUM(" + - ScRange(ScAddress(4,1,nTab), - ScAddress(4,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) + - ")"; - } -}; - -struct Round : Area -{ - Round() : - Area("Round") - { - } - - virtual ~Round() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const override - { - pDoc->SetString(ScAddress(0,0,nTab), "x"); - pDoc->SetString(ScAddress(1,0,nTab), "n"); - pDoc->SetString(ScAddress(2,0,nTab), "ROUND(x,n)"); - pDoc->SetString(ScAddress(3,0,nTab), "expected"); - } - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const override - { - const double nX(comphelper::rng::uniform_real_distribution(0, 100)); - const int nN(comphelper::rng::uniform_int_distribution(1, 10)); - - pDoc->SetValue(ScAddress(0,1+nRow,nTab), nX); - pDoc->SetValue(ScAddress(1,1+nRow,nTab), nN); - - pDoc->SetString(ScAddress(2,1+nRow,nTab), - "=ROUND(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "," + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")"); - - pDoc->SetValue(ScAddress(3,1+nRow,nTab), ::rtl::math::round(nX, (short) nN)); - - pDoc->SetString(ScAddress(4,1+nRow,nTab), - "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=3e-10" - ",0,1)"); - } - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const override - { - return "=SUM(" + - ScRange(ScAddress(4,1,nTab), - ScAddress(4,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) + - ")"; - } - -}; - -struct Normdist : Area -{ - Normdist() : - Area("Normdist") - { - } - - virtual ~Normdist() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const override - { - pDoc->SetString(ScAddress(0,0,nTab), "num"); - pDoc->SetString(ScAddress(1,0,nTab), "avg"); - pDoc->SetString(ScAddress(2,0,nTab), "stdev"); - pDoc->SetString(ScAddress(3,0,nTab), "type"); - pDoc->SetString(ScAddress(4,0,nTab), "NORMDIST(num,avg,stdev,type)"); - pDoc->SetString(ScAddress(5,0,nTab), "expected"); - } - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const override - { - const double nNum(comphelper::rng::uniform_real_distribution(0, 100)); - const double nAvg(comphelper::rng::uniform_real_distribution(0, 100)); - const double nStDev(comphelper::rng::uniform_real_distribution(1, 10)); - const int nType(comphelper::rng::uniform_int_distribution(0, 1)); - - pDoc->SetValue(ScAddress(0,1+nRow,nTab), nNum); - pDoc->SetValue(ScAddress(1,1+nRow,nTab), nAvg); - pDoc->SetValue(ScAddress(2,1+nRow,nTab), nStDev); - pDoc->SetValue(ScAddress(3,1+nRow,nTab), nType); - - pDoc->SetString(ScAddress(4,1+nRow,nTab), - "=NORMDIST(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "," + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "," + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "," + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")"); - - if (nType == 1) - pDoc->SetValue(ScAddress(5,1+nRow,nTab), ScInterpreter::integralPhi((nNum-nAvg)/nStDev)); - else - pDoc->SetValue(ScAddress(5,1+nRow,nTab), ScInterpreter::phi((nNum-nAvg)/nStDev)/nStDev); - - pDoc->SetString(ScAddress(6,1+nRow,nTab), - "=IF(ABS(" + ScAddress(4,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(5,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=3e-10" - ",0,1)"); - } - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const override - { - return "=SUM(" + - ScRange(ScAddress(6,1,nTab), - ScAddress(6,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) + - ")"; - } - -}; - -struct Reduction : Op -{ - double mnAccumInitial; - double (*mpFun)(double nAccum, double nArg, const Reduction& rReduction); - bool (*mpFilterOut)(double nArg); - - Reduction(const OUString& rTitle, - const OUString& rOp, - double nAccumInitial, - double nRangeLo, double nRangeHi, - double nEpsilon, - double (*pFun)(double nAccum, double nArg, const Reduction& rReduction), - bool (*pFilterOut)(double nArg) = nullptr) : - Op(rTitle, rOp, nRangeLo, nRangeHi, nEpsilon), - mnAccumInitial(nAccumInitial), - mpFun(pFun), - mpFilterOut(pFilterOut) - { - } - - virtual ~Reduction() - { - } - - virtual void addHeader(ScDocument *pDoc, int nTab) const override - { - pDoc->SetString(ScAddress(0,0,nTab), "x"); - pDoc->SetString(ScAddress(1,0,nTab), msOp); - pDoc->SetString(ScAddress(2,0,nTab), "expected"); - } - - virtual void addRow(ScDocument *pDoc, int nRow, int nTab) const override - { - double nArg; - - do { - nArg = comphelper::rng::uniform_real_distribution(mnRangeLo, mnRangeHi); - } while (mpFilterOut != nullptr && mpFilterOut(nArg)); - - pDoc->SetValue(ScAddress(0,1+nRow,nTab), nArg); - - if (nRow >= mnRows/2-1) - { - pDoc->SetString(ScAddress(1,1+nRow-mnRows/2+1,nTab), - "=" + msOp + "(" + - ScRange(ScAddress(0,1+nRow-mnRows/2+1,nTab), - ScAddress(0,1+nRow,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")"); - - double nAccum(mnAccumInitial); - for (int i = 0; i < mnRows/2; i++) - nAccum = mpFun(nAccum, pDoc->GetValue(ScAddress(0,1+nRow-mnRows/2+i+1,nTab)), *this); - - pDoc->SetValue(ScAddress(2,1+nRow-mnRows/2+1,nTab), nAccum); - - if (mnEpsilon != 0) - pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab), - "=IF(ABS(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "-" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ")<=" + OUString::number(mnEpsilon) + - ",0,1)"); - else - pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab), - "=IF(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - "=" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + - ",0,1)"); - } - } - - virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const override - { - return "=SUM(" + - ScRange(ScAddress(3,1+0,nTab), - ScAddress(3,1+mnRows-mnRows/2-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) + - ")"; - } -}; - -} - -IMPL_STATIC_LINK_TYPED(ScCalcOptionsDialog, TestClickHdl, Button*, pButton, void) -{ - pButton->Disable(); - - // Automatically test the current implementation of OpenCL. If it - // seems good, whitelist it. If it seems bad, blacklist it. - - std::unique_ptr<OpenCLTester> xTestDocument(new OpenCLTester()); - - xTestDocument->addTest(BinOp("Plus", "+", -1000, 1000, 3e-10, - [] (double nLhs, double nRhs) - { - return nLhs + nRhs; - })); - - xTestDocument->addTest(BinOp("Minus", "-", -1000, 1000, 3e-10, - [] (double nLhs, double nRhs) - { - return nLhs - nRhs; - })); - - xTestDocument->addTest(BinOp("Times", "*", -1000, 1000, 3e-10, - [] (double nLhs, double nRhs) - { - return nLhs * nRhs; - })); - - xTestDocument->addTest(BinOp("Divided", "/", -1000, 1000, 3e-10, - [] (double nLhs, double nRhs) - { - return nLhs / nRhs; - }, - [] (double, double nRhs) - { - return (nRhs == 0); - })); - - xTestDocument->addTest(UnOp("Sin", "SIN", -10, 10, 3e-10, - [] (double nArg) - { - return sin(nArg); - })); - - xTestDocument->addTest(UnOp("Cos", "COS", -10, 10, 3e-10, - [] (double nArg) - { - return cos(nArg); - })); - - xTestDocument->addTest(UnOp("Tan", "TAN", 0, 10, -3e-10, - [] (double nArg) - { - return tan(nArg); - }, - [] (double nArg) - { - return (std::fmod(nArg, M_PI) == M_PI/2); - })); - - xTestDocument->addTest(UnOp("Atan", "ATAN", -10, 10, 3e-10, - [] (double nArg) - { - return atan(nArg); - })); - - xTestDocument->addTest(UnOp("Sqrt", "SQRT", 0, 1000, 3e-10, - [] (double nArg) - { - return sqrt(nArg); - })); - - xTestDocument->addTest(UnOp("Exp", "EXP", 0, 10, 3e-10, - [] (double nArg) - { - return exp(nArg); - })); - - xTestDocument->addTest(UnOp("Ln", "LN", 0, 1000, 3e-10, - [] (double nArg) - { - return log(nArg); - }, - [] (double nArg) - { - return (nArg == 0); - })); - - xTestDocument->addTest(UnOp("NormSInv", "NORMSINV", 0, 1, 3e-10, - [] (double nArg) - { - return ScInterpreter::gaussinv(nArg); - })); - - xTestDocument->addTest(Round()); - - xTestDocument->addTest(Normdist()); - - xTestDocument->addTest(Reduction("Sum", "SUM", 0, -1000, 1000, 3e-10, - [] (double nAccum, double nArg, const Reduction&) - { - return (nAccum + nArg); - })); - - xTestDocument->addTest(Reduction("Average", "AVERAGE", 0, -1000, 1000, 3e-10, - [] (double nAccum, double nArg, const Reduction& rReduction) - { - return (nAccum + nArg/(rReduction.mnRows/2)); - })); - - xTestDocument->addTest(Reduction("Product", "PRODUCT", 1, 0.1, 2.5, 3e-10, - [] (double nAccum, double nArg, const Reduction&) - { - return (nAccum * nArg); - })); - - xTestDocument->addTest(Reduction("Min", "MIN", DBL_MAX, -1000, 1000, 0, - [] (double nAccum, double nArg, const Reduction&) - { - return std::min(nAccum, nArg); - })); - - xTestDocument->addTest(Reduction("Max", "MAX", -DBL_MAX, -1000, 1000, 0, - [] (double nAccum, double nArg, const Reduction&) - { - return std::max(nAccum, nArg); - })); - - xTestDocument->mpDoc->CalcAll(); - ScInterpreter::SetGlobalConfig(xTestDocument->mpOldCalcConfig); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 1fc6731..317f793 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -40,7 +40,6 @@ public: DECL_LINK_TYPED( BtnAutomaticSelectHdl, RadioButton&, void ); DECL_LINK_TYPED( EditModifiedHdl, Edit&, void ); - DECL_STATIC_LINK_TYPED( ScCalcOptionsDialog, TestClickHdl, Button*, void ); DECL_LINK_TYPED( AsZeroModifiedHdl, Button*, void); DECL_LINK_TYPED( ConversionModifiedHdl, ListBox&, void); DECL_LINK_TYPED( SyntaxModifiedHdl, ListBox&, void); @@ -65,7 +64,6 @@ private: VclPtr<CheckBox> mpUseOpenCL; VclPtr<NumericField> mpSpinButton; VclPtr<VclMultiLineEdit> mpEditField; - VclPtr<PushButton> mpTestButton; ScCalcConfig maConfig; diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui index fa3ca94..d748f7d 100644 --- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui +++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui @@ -224,21 +224,6 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkButton" id="test"> - <property name="label" translatable="yes">_Test OpenCL</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="halign">center</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - <property name="width">2</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="CBUseOpenCL"> <property name="label" translatable="yes">Use Open_CL only for a subset of operations</property> <property name="visible">True</property> commit a92da660cd4aae511785da4f3a276309c64b47f7 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Jul 27 10:59:00 2016 +0300 Remove effectively dead code We haven't displayed any list of OpenCL devices to select from in this dialog for a long time, so remove the associated code. Change-Id: Ife0c624a8bfb829bd1e62e0a000c7681d696f40b diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 5942266..2d91a79 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -84,12 +84,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi , mbWriteConfig(bWriteConfig) { get(mpTestButton, "test"); - get(mpOpenclInfoList, "opencl_list"); - get(mpBtnAutomaticSelectionTrue, "automatic_select_true"); - get(mpBtnAutomaticSelectionFalse, "automatic_select_false"); - get(mpFtFrequency, "frequency"); - get(mpFtComputeUnits, "compute_units"); - get(mpFtMemory, "memory"); get(mpConversion,"comboConversion"); mpConversion->SelectEntryPos(static_cast<sal_Int32>(rConfig.meStringConversion)); @@ -122,16 +116,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl)); - mpOpenclInfoList->set_height_request(4* mpOpenclInfoList->GetTextHeight()); - mpOpenclInfoList->SetStyle(mpOpenclInfoList->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE); - mpOpenclInfoList->SetHighlightRange(); - mpOpenclInfoList->GetParent()->Hide(); - mpOpenclInfoList->SetSelectHdl(LINK(this, ScCalcOptionsDialog, DeviceSelHdl)); - - mpBtnAutomaticSelectionTrue->SetToggleHdl(LINK(this, ScCalcOptionsDialog, BtnAutomaticSelectHdl)); - - maSoftware = get<vcl::Window>("software")->GetText(); - mpTestButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, TestClickHdl)); } @@ -150,58 +134,9 @@ void ScCalcOptionsDialog::dispose() mpSpinButton.clear(); mpEditField.clear(); mpTestButton.clear(); - mpFtFrequency.clear(); - mpFtComputeUnits.clear(); - mpFtMemory.clear(); - mpOpenclInfoList.clear(); - mpBtnAutomaticSelectionTrue.clear(); - mpBtnAutomaticSelectionFalse.clear(); ModalDialog::dispose(); } -void ScCalcOptionsDialog::OpenCLAutomaticSelectionChanged() -{ - bool bValue = mpBtnAutomaticSelectionTrue->IsChecked(); - if(bValue) - mpOpenclInfoList->Disable(); - else - mpOpenclInfoList->Enable(); - - maConfig.mbOpenCLAutoSelect = bValue; -} - -void ScCalcOptionsDialog::SelectedDeviceChanged() -{ -#if HAVE_FEATURE_OPENCL - SvTreeListEntry* pEntry = mpOpenclInfoList->GetModel()->GetView(0)->FirstSelected(); - if(!pEntry) - return; - - OpenCLDeviceInfo* pInfo = static_cast<OpenCLDeviceInfo*>(pEntry->GetUserData()); - if(pInfo) - { - mpFtFrequency->SetText(OUString::number(pInfo->mnFrequency)); - mpFtComputeUnits->SetText(OUString::number(pInfo->mnComputeUnits)); - mpFtMemory->SetText(OUString::number(pInfo->mnMemory/1024/1024)); - } - else - { - mpFtFrequency->SetText(OUString()); - mpFtComputeUnits->SetText(OUString()); - mpFtMemory->SetText(OUString()); - } - - SvLBoxString& rBoxEntry = dynamic_cast<SvLBoxString&>(pEntry->GetItem(1)); - - OUString aDevice = rBoxEntry.GetText(); - // use english string for configuration - if(aDevice == maSoftware) - aDevice = OPENCL_SOFTWARE_DEVICE_CONFIG_NAME; - - maConfig.maOpenCLDevice = aDevice; -#endif -} - void ScCalcOptionsDialog::CoupleEmptyAsZeroToStringConversion() { switch (maConfig.meStringConversion) @@ -257,16 +192,6 @@ IMPL_LINK_TYPED(ScCalcOptionsDialog, SpinOpenCLMinSizeHdl, Edit&, rEdit, void) maConfig.mnOpenCLMinimumFormulaGroupSize = static_cast<NumericField&>(rEdit).GetValue(); } -IMPL_LINK_NOARG_TYPED(ScCalcOptionsDialog, BtnAutomaticSelectHdl, RadioButton&, void) -{ - OpenCLAutomaticSelectionChanged(); -} - -IMPL_LINK_NOARG_TYPED(ScCalcOptionsDialog, DeviceSelHdl, SvTreeListBox*, void) -{ - SelectedDeviceChanged(); -} - IMPL_LINK_TYPED(ScCalcOptionsDialog, EditModifiedHdl, Edit&, rCtrl, void) { maConfig.mpOpenCLSubsetOpCodes = ScStringToOpCodeSet(rCtrl.GetText()); diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index c7f2ffc..1fc6731 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -39,7 +39,6 @@ public: virtual void dispose() override; DECL_LINK_TYPED( BtnAutomaticSelectHdl, RadioButton&, void ); - DECL_LINK_TYPED( DeviceSelHdl, SvTreeListBox*, void ); DECL_LINK_TYPED( EditModifiedHdl, Edit&, void ); DECL_STATIC_LINK_TYPED( ScCalcOptionsDialog, TestClickHdl, Button*, void ); DECL_LINK_TYPED( AsZeroModifiedHdl, Button*, void); @@ -68,16 +67,6 @@ private: VclPtr<VclMultiLineEdit> mpEditField; VclPtr<PushButton> mpTestButton; - VclPtr<FixedText> mpFtFrequency; - VclPtr<FixedText> mpFtComputeUnits; - VclPtr<FixedText> mpFtMemory; - - VclPtr<SvTreeListBox> mpOpenclInfoList; - VclPtr<RadioButton> mpBtnAutomaticSelectionTrue; - VclPtr<RadioButton> mpBtnAutomaticSelectionFalse; - - OUString maSoftware; - ScCalcConfig maConfig; bool mbSelectedEmptyStringAsZero; diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui index bf1c6b0..fa3ca94 100644 --- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui +++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui @@ -224,174 +224,6 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkGrid" id="grid6"> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="row_spacing">6</property> - <child> - <object class="svtlo-SvTreeListBox" id="opencl_list:border"> - <property name="visible">True</property> - <property name="app_paintable">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="Tree List-selection"/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Automatic selection of platform/device:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="automatic_select_true"> - <property name="label" translatable="yes">True</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_select_false</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="automatic_select_false"> - <property name="label" translatable="yes">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <property name="group">automatic_select_true</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="frequency_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Frequency:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="compute_units_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Compute units:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="memory_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Memory (in MB):</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="frequency"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="compute_units"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="memory"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="software"> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Internal, software interpreter</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> - </packing> - </child> - <child> <object class="GtkButton" id="test"> <property name="label" translatable="yes">_Test OpenCL</property> <property name="visible">True</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits