resolved fdo#73555 compile statistics templates using English grammar

The statistics templates' formula expressions are setup using English
function names, so compile the resulting expressions using an English
grammar merged with the current address conventions.

Change-Id: I7c782a42d007daeaaf99463beb8aa580c05c7363
This commit is contained in:
Eike Rathke
2014-01-13 18:02:21 +01:00
parent 01f3186c4b
commit 9570a27d3e
8 changed files with 24 additions and 13 deletions

View File

@@ -104,7 +104,8 @@ sal_Int16 ScAnalysisOfVarianceDialog::GetUndoNameId()
ScRange ScAnalysisOfVarianceDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
output.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_SINGLE_FACTOR_LABEL));

View File

@@ -83,7 +83,8 @@ sal_Int16 ScDescriptiveStatisticsDialog::GetUndoNameId()
ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
boost::scoped_ptr<DataRangeIterator> pIterator;

View File

@@ -52,7 +52,8 @@ sal_Int16 ScExponentialSmoothingDialog::GetUndoNameId()
ScRange ScExponentialSmoothingDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
// Smoothing factor

View File

@@ -74,7 +74,8 @@ sal_Int16 ScMatrixComparisonGenerator::GetUndoNameId()
ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
SCTAB inTab = mInputRange.aStart.Tab();

View File

@@ -52,7 +52,8 @@ sal_Int16 ScMovingAverageDialog::GetUndoNameId()
ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
boost::scoped_ptr<DataRangeIterator> pIterator;

View File

@@ -60,7 +60,8 @@ sal_Int16 ScTTestDialog::GetUndoNameId()
ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument);
AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
FormulaTemplate aTemplate(mDocument, mAddressDetails);
boost::scoped_ptr<DataRangeIterator> pVariable1Iterator;

View File

@@ -152,15 +152,18 @@ void AddressWalker::pop()
mAddressStack.pop_back();
}
AddressWalkerWriter::AddressWalkerWriter(ScAddress aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument) :
AddressWalkerWriter::AddressWalkerWriter(ScAddress aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument,
formula::FormulaGrammar::Grammar eGrammar ) :
AddressWalker(aInitialAddress, true),
mpDocShell(pDocShell),
mpDocument(pDocument)
mpDocument(pDocument),
meGrammar(eGrammar)
{}
void AddressWalkerWriter::writeFormula(OUString aFormula)
{
mpDocShell->GetDocFunc().SetFormulaCell(mCurrentAddress, new ScFormulaCell(mpDocument, mCurrentAddress, aFormula), true);
mpDocShell->GetDocFunc().SetFormulaCell(mCurrentAddress,
new ScFormulaCell(mpDocument, mCurrentAddress, aFormula, meGrammar), true);
}
void AddressWalkerWriter::writeMatrixFormula(OUString aFormula)
@@ -168,7 +171,7 @@ void AddressWalkerWriter::writeMatrixFormula(OUString aFormula)
ScRange aRange;
aRange.aStart = mCurrentAddress;
aRange.aEnd = mCurrentAddress;
mpDocShell->GetDocFunc().EnterMatrix(aRange, NULL, NULL, aFormula, false, false, OUString(), formula::FormulaGrammar::GRAM_DEFAULT );
mpDocShell->GetDocFunc().EnterMatrix(aRange, NULL, NULL, aFormula, false, false, OUString(), meGrammar );
}
void AddressWalkerWriter::writeString(OUString aString)

View File

@@ -76,10 +76,12 @@ public:
class AddressWalkerWriter : public AddressWalker
{
public:
ScDocShell* mpDocShell;
ScDocument* mpDocument;
ScDocShell* mpDocShell;
ScDocument* mpDocument;
formula::FormulaGrammar::Grammar meGrammar;
AddressWalkerWriter(ScAddress aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument);
AddressWalkerWriter(ScAddress aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument,
formula::FormulaGrammar::Grammar eGrammar );
void writeFormula(OUString aFormula);
void writeMatrixFormula(OUString aFormula);