[Libreoffice-commits] core.git: 4 commits - sc/source sw/source
Caolán McNamara
caolanm at redhat.com
Wed Jan 28 08:22:04 PST 2015
sc/source/core/inc/interpre.hxx | 2 -
sc/source/ui/optdlg/calcoptionsdlg.cxx | 57 +++++++++++++++++++++++++++++++--
sw/source/uibase/wrtsh/wrtsh2.cxx | 56 +++++++++++++++++++-------------
3 files changed, 89 insertions(+), 26 deletions(-)
New commits:
commit 1ecf795ffaf8c63280ea92f776b53558b3227504
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 28 15:57:10 2015 +0000
Related: tdf#82942 multiple crashes on changing text in SwInputFields
i.e. load doc keeping setting text of "LINE" + ok as each popup appears
will crash eventually
Change-Id: Ibc4bb8fe65bd5dd380c0fe833e5ece2b39de5dbe
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 44b9183..a11dda2 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -175,7 +175,34 @@ void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst )
class FieldDeletionModify : public SwModify
{
public:
- FieldDeletionModify(AbstractFldInputDlg* pInputFieldDlg) : mpInputFieldDlg(pInputFieldDlg) {}
+ FieldDeletionModify(AbstractFldInputDlg* pInputFieldDlg, SwField* pFld)
+ : mpInputFieldDlg(pInputFieldDlg)
+ {
+ SwInputField *const pInputField(dynamic_cast<SwInputField*>(pFld));
+ SwSetExpField *const pSetExpFld(dynamic_cast<SwSetExpField*>(pFld));
+
+ if (pInputField && pInputField->GetFmtFld())
+ {
+ mpFmtFld = pInputField->GetFmtFld();
+ }
+ else if (pSetExpFld && pSetExpFld->GetFmtFld())
+ {
+ mpFmtFld = pSetExpFld->GetFmtFld();
+ }
+
+ // Register for possible field deletion while dialog is open
+ if (mpFmtFld)
+ mpFmtFld->Add(this);
+ }
+
+ ~FieldDeletionModify()
+ {
+ if (mpFmtFld)
+ {
+ // Dialog closed, remove modification listener
+ mpFmtFld->Remove(this);
+ }
+ }
void Modify( const SfxPoolItem* pOld, const SfxPoolItem *) SAL_OVERRIDE
{
@@ -186,6 +213,7 @@ class FieldDeletionModify : public SwModify
{
case RES_REMOVE_UNO_OBJECT:
case RES_OBJECTDYING:
+ mpFmtFld = NULL;
mpInputFieldDlg->EndDialog(RET_CANCEL);
break;
}
@@ -193,10 +221,10 @@ class FieldDeletionModify : public SwModify
}
private:
AbstractFldInputDlg* mpInputFieldDlg;
+ SwFmtFld* mpFmtFld;
};
// Start input dialog for a specific field
-
bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool bNextButton,
vcl::Window* pParentWin, OString* pWindowState )
{
@@ -208,29 +236,11 @@ bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool bNextButton,
if(pWindowState && !pWindowState->isEmpty())
pDlg->SetWindowState(*pWindowState);
- FieldDeletionModify aModify(pDlg.get());
- SwInputField *const pInputField(dynamic_cast<SwInputField*>(pFld));
- SwSetExpField *const pSetExpFld(dynamic_cast<SwSetExpField*>(pFld));
- if (pInputField && pInputField->GetFmtFld())
- {
- // Register for possible input field deletion while dialog is open
- pInputField->GetFmtFld()->Add(&aModify);
- }
- else if (pSetExpFld && pSetExpFld->GetFmtFld())
- {
- pSetExpFld->GetFmtFld()->Add(&aModify);
- }
-
- bool bRet = RET_CANCEL == pDlg->Execute();
+ bool bRet;
- if (pInputField && pInputField->GetFmtFld())
- {
- // Dialog closed, remove modification listener
- pInputField->GetFmtFld()->Remove(&aModify);
- }
- else if (pSetExpFld && pSetExpFld->GetFmtFld())
{
- pSetExpFld->GetFmtFld()->Remove(&aModify);
+ FieldDeletionModify aModify(pDlg.get(), pFld);
+ bRet = RET_CANCEL == pDlg->Execute();
}
if(pWindowState)
commit 3e964eff2d6f01bb69e10279504319d0d6cb5d79
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 17:01:14 2015 +0200
Use minimum necessary value for nRows
Just temporary (haha, let's see...), the Right Thing would be to turn the
mnOpenCLMinimumFormulaGroupSize down to some small value for the duration of
the test document's construction and calculation, and then return it to its
prevous value once the document has been dismissed.
Change-Id: I52e9813af1ceb2410ef74723fadee21b89cffe47
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 21da615..6483562 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) :
+ Area(const OUString& rTitle, int nRows = ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize + 1) :
msTitle(rTitle),
mnRows(nRows)
{
@@ -306,7 +306,7 @@ struct Op : Area
const OUString& rOp,
double nRangeLo, double nRangeHi,
double nEpsilon) :
- Area(rTitle, 200),
+ Area(rTitle),
msOp(rOp),
mnRangeLo(nRangeLo),
mnRangeHi(nRangeHi),
@@ -458,7 +458,7 @@ struct BinOp : Op
struct Round : Area
{
Round() :
- Area("Round", 200)
+ Area("Round")
{
}
commit 691553c19f0a8abbdb595a4375de1cf9904df932
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 17:00:30 2015 +0200
Make ScInterpreter::GetGlobalConfig() SC_DLLPUBLIC
Change-Id: Idd27688055a08ffe9a6970c28cd7da6f6e1a7f66
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 6f9e1e6..ff7fb11 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -119,7 +119,7 @@ public:
DECL_FIXEDMEMPOOL_NEWDEL( ScInterpreter )
static void SetGlobalConfig(const ScCalcConfig& rConfig);
- static const ScCalcConfig& GetGlobalConfig();
+ static SC_DLLPUBLIC const ScCalcConfig& GetGlobalConfig();
static void GlobalExit(); // called by ScGlobal::Clear()
commit 0132711bce74c6e3a3658ddd35b4973ad2b4cce0
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Jan 28 16:49:18 2015 +0200
Add ROUND test
Change-Id: Ifa0c2bc6767d9d2e9b27c5a6b30929463b20407c
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index f816ab4..21da615 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -455,6 +455,57 @@ struct BinOp : Op
}
};
+struct Round : Area
+{
+ Round() :
+ Area("Round", 200)
+ {
+ }
+
+ virtual ~Round()
+ {
+ }
+
+ virtual void addHeader(ScDocument *pDoc, int nTab) const SAL_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 SAL_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(SCA_VALID_COL|SCA_VALID_ROW) +
+ "," + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ ")");
+
+ pDoc->SetValue(ScAddress(3,1+nRow,nTab), ::rtl::math::round(nX, (short) nN, rtl_math_RoundingMode_Corrected));
+
+ pDoc->SetString(ScAddress(4,1+nRow,nTab),
+ "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "-" + ScAddress(3,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ ")<=3e-10"
+ ",0,1)");
+ }
+
+ virtual OUString getSummaryFormula(ScDocument *pDoc, int nTab) const SAL_OVERRIDE
+ {
+ return "=SUM(" +
+ ScRange(ScAddress(4,1,nTab),
+ ScAddress(4,1+mnRows-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ")";
+ }
+
+};
+
struct Reduction : Op
{
int mnNum;
@@ -629,6 +680,8 @@ IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, )
return ScInterpreter::gaussinv(nArg);
}));
+ xTestDocument->addTest(Round());
+
xTestDocument->addTest(Reduction("Sum", "SUM", 100, 0, -1000, 1000, 3e-10,
[] (double nAccum, double nArg)
{
More information about the Libreoffice-commits
mailing list