[Libreoffice-commits] core.git: 5 commits - sc/inc sc/source sw/source
Tor Lillqvist
tml at collabora.com
Wed Jan 28 11:00:38 PST 2015
sc/inc/document.hxx | 4 -
sc/source/core/inc/interpre.hxx | 2
sc/source/ui/optdlg/calcoptionsdlg.cxx | 75 ++++++++++++++++++---------------
sw/source/uibase/wrtsh/wrtsh2.cxx | 2
4 files changed, 46 insertions(+), 37 deletions(-)
New commits:
commit 063105b4af5518fd8306246ea49326958e435e1a
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 20:58:43 2015 +0200
Disable the 'Test OpenCL' button once pressed
Change-Id: I6678502472f646ae770be4d17d85f2a02fba8f4b
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 12b071f..0eada39 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -655,8 +655,10 @@ struct Reduction : Op
}
-IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, )
+IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, pButton)
{
+ pButton->Disable();
+
// Automatically test the current implementation of OpenCL. If it
// seems good, whitelist it. If it seems bad, blacklist it.
commit e6a1f33e500c4fb5e38e7d6de7ddb55af8fa8650
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 20:29:23 2015 +0200
WaE: overriding destructor declaration not explicitly marked 'virtual'
Change-Id: I4f155f8a28afa6a16b1859b254a339d8374a769b
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index a11dda2..0bb3850 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -195,7 +195,7 @@ class FieldDeletionModify : public SwModify
mpFmtFld->Add(this);
}
- ~FieldDeletionModify()
+ virtual ~FieldDeletionModify()
{
if (mpFmtFld)
{
commit c8818044e6e0cbcca0dcbd4aada7b260f88e8818
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 20:00:29 2015 +0200
Make the OpenCL test document construction and calculation a bit faster
Turn off AutoCalc while constructing it and then calculate it when ready.
Use a smaller number for the minimum formula group size required for OpenCL to
be used while calculating it. Use less hardcoded magic numbers in the code.
Change-Id: I6f2c3b1035947a542776d6087bd229cb9c2892fb
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index a460f54..12b071f 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -231,7 +231,7 @@ struct Area
OUString msTitle;
int mnRows;
- Area(const OUString& rTitle, int nRows = ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize + 1) :
+ Area(const OUString& rTitle, int nRows = ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize + 2) :
msTitle(rTitle),
mnRows(nRows)
{
@@ -253,6 +253,8 @@ struct OpenCLTester
int mnTestAreas;
ScDocShell* mpDocShell;
ScDocument *mpDoc;
+ bool mbOldAutoCalc;
+ ScCalcConfig maOldCalcConfig;
OpenCLTester() :
mnTestAreas(0)
@@ -269,13 +271,18 @@ struct OpenCLTester
mpDoc = &mpDocShell->GetDocument();
+ mbOldAutoCalc = mpDoc->GetAutoCalc();
+ mpDoc->SetAutoCalc(false);
+ maOldCalcConfig = ScInterpreter::GetGlobalConfig();
+ ScCalcConfig aConfig(maOldCalcConfig);
+ aConfig.mnOpenCLMinimumFormulaGroupSize = 20;
+ ScInterpreter::SetGlobalConfig(aConfig);
+
mpDoc->SetString(ScAddress(0,0,0), "Result:");
}
void addTest(const Area &rArea)
{
- sc::AutoCalcSwitch aACSwitch(*mpDoc, true);
-
mnTestAreas++;
(void) mpDocShell->GetDocFunc().InsertTable(mnTestAreas, rArea.msTitle, false, true);
@@ -570,21 +577,18 @@ struct Normdist : Area
struct Reduction : Op
{
- int mnNum;
double mnAccumInitial;
- double (*mpFun)(double nAccum, double nArg);
+ double (*mpFun)(double nAccum, double nArg, const Reduction& rReduction);
bool (*mpFilterOut)(double nArg);
Reduction(const OUString& rTitle,
const OUString& rOp,
- int nNum,
double nAccumInitial,
double nRangeLo, double nRangeHi,
double nEpsilon,
- double (*pFun)(double nAccum, double nArg),
+ double (*pFun)(double nAccum, double nArg, const Reduction& rReduction),
bool (*pFilterOut)(double nArg) = nullptr) :
Op(rTitle, rOp, nRangeLo, nRangeHi, nEpsilon),
- mnNum(nNum),
mnAccumInitial(nAccumInitial),
mpFun(pFun),
mpFilterOut(pFilterOut)
@@ -612,30 +616,30 @@ struct Reduction : Op
pDoc->SetValue(ScAddress(0,1+nRow,nTab), nArg);
- if (nRow >= mnNum-1)
+ if (nRow >= mnRows/2-1)
{
- pDoc->SetString(ScAddress(1,1+nRow-mnNum+1,nTab),
+ pDoc->SetString(ScAddress(1,1+nRow-mnRows/2+1,nTab),
"=" + msOp + "(" +
- ScRange(ScAddress(0,1+nRow-mnNum+1,nTab),
+ ScRange(ScAddress(0,1+nRow-mnRows/2+1,nTab),
ScAddress(0,1+nRow,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW) +
")");
double nAccum(mnAccumInitial);
- for (int i = 0; i < mnNum; i++)
- nAccum = mpFun(nAccum, pDoc->GetValue(ScAddress(0,1+nRow-mnNum+i+1,nTab)));
+ 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-mnNum+1,nTab), nAccum);
+ pDoc->SetValue(ScAddress(2,1+nRow-mnRows/2+1,nTab), nAccum);
if (mnEpsilon != 0)
- pDoc->SetString(ScAddress(3,1+nRow-mnNum+1,nTab),
- "=IF(ABS(" + ScAddress(1,1+nRow-mnNum+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(2,1+nRow-mnNum+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab),
+ "=IF(ABS(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "-" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
")<=" + OUString::number(mnEpsilon) +
",0,1)");
else
- pDoc->SetString(ScAddress(3,1+nRow-mnNum+1,nTab),
- "=IF(" + ScAddress(1,1+nRow-mnNum+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "=" + ScAddress(2,1+nRow-mnNum+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab),
+ "=IF(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
",0,1)");
}
}
@@ -644,7 +648,7 @@ struct Reduction : Op
{
return "=SUM(" +
ScRange(ScAddress(3,1+0,nTab),
- ScAddress(3,1+mnRows-mnNum-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(3,1+mnRows-mnRows/2-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
")";
}
};
@@ -746,36 +750,39 @@ IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, )
xTestDocument->addTest(Normdist());
- xTestDocument->addTest(Reduction("Sum", "SUM", 100, 0, -1000, 1000, 3e-10,
- [] (double nAccum, double nArg)
+ xTestDocument->addTest(Reduction("Sum", "SUM", 0, -1000, 1000, 3e-10,
+ [] (double nAccum, double nArg, const Reduction&)
{
return (nAccum + nArg);
}));
- xTestDocument->addTest(Reduction("Average", "AVERAGE", 100, 0, -1000, 1000, 3e-10,
- [] (double nAccum, double nArg)
+ xTestDocument->addTest(Reduction("Average", "AVERAGE", 0, -1000, 1000, 3e-10,
+ [] (double nAccum, double nArg, const Reduction& rReduction)
{
- return (nAccum + nArg/100.);
+ return (nAccum + nArg/(rReduction.mnRows/2));
}));
- xTestDocument->addTest(Reduction("Product", "PRODUCT", 100, 1, 0.1, 2.5, 3e-10,
- [] (double nAccum, double nArg)
+ 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", 100, DBL_MAX, -1000, 1000, 0,
- [] (double nAccum, double 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", 100, -DBL_MAX, -1000, 1000, 0,
- [] (double nAccum, double 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->maOldCalcConfig);
+
return 0;
}
commit 1224bca6b7815760f106116b0dd1a895563c019b
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 20:00:10 2015 +0200
Make SetGlobalConfig() public
Change-Id: Ia4ac90c369a8e33ddefc6a87f877b98491efcede
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 094292a..0b669ec 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -118,7 +118,7 @@ class ScInterpreter
public:
DECL_FIXEDMEMPOOL_NEWDEL( ScInterpreter )
- static void SetGlobalConfig(const ScCalcConfig& rConfig);
+ static SC_DLLPUBLIC void SetGlobalConfig(const ScCalcConfig& rConfig);
static SC_DLLPUBLIC const ScCalcConfig& GetGlobalConfig();
static void GlobalExit(); // called by ScGlobal::Clear()
commit c65e51d70747e4664c37a8226dbe2b12399d7146
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 19:59:35 2015 +0200
Make GetAutoCalc() and SetAutoCalc() public
Change-Id: I25d681b4b1e35af49b6631b2c3de2ccc296b9b42
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index dd5175a..d3fe564 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1060,8 +1060,8 @@ public:
void ClearLookupCaches();
// calculate automatically
- void SetAutoCalc( bool bNewAutoCalc );
- bool GetAutoCalc() const { return bAutoCalc; }
+ SC_DLLPUBLIC void SetAutoCalc( bool bNewAutoCalc );
+ SC_DLLPUBLIC bool GetAutoCalc() const { return bAutoCalc; }
// calculate automatically in/from/for ScDocShell disabled
void SetAutoCalcShellDisabled( bool bNew ) { bAutoCalcShellDisabled = bNew; }
bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
More information about the Libreoffice-commits
mailing list