Kaydet (Commit) a204a7cc authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

sc: Add newLine() convenience method to AddressWalker

And use the newLine() method in t-test and F-test.

Change-Id: I6372fe1fbc1f63bca56b110115732de96eb2afcf
üst 2afa719d
...@@ -80,22 +80,19 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -80,22 +80,19 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get()); aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get());
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME));
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString("Alpha"); aOutput.writeString("Alpha");
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeValue(0.05); aOutput.writeValue(0.05);
aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current()); aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -104,8 +101,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -104,8 +101,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)"); aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -116,8 +112,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -116,8 +112,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=VAR(%VAR2_RANGE%)"); aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current()); aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -128,8 +123,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -128,8 +123,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)"); aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_OBSERVATIONS%", aOutput.current()); aTemplate.autoReplaceAddress("%VAR2_OBSERVATIONS%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -140,54 +134,46 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -140,54 +134,46 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=%VAR2_OBSERVATIONS% - 1"); aTemplate.setTemplate("=%VAR2_OBSERVATIONS% - 1");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VAR2_DEGREE_OF_FREEDOM%", aOutput.current()); aTemplate.autoReplaceAddress("%VAR2_DEGREE_OF_FREEDOM%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_F)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_F));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=%VAR1_VARIANCE% / %VAR2_VARIANCE%"); aTemplate.setTemplate("=%VAR1_VARIANCE% / %VAR2_VARIANCE%");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%F_VALUE%", aOutput.current()); aTemplate.autoReplaceAddress("%F_VALUE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_RIGHT_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_RIGHT_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=FDIST(%F_VALUE%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); aTemplate.setTemplate("=FDIST(%F_VALUE%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%P_RIGHT_TAIL_VALUE%", aOutput.current()); aTemplate.autoReplaceAddress("%P_RIGHT_TAIL_VALUE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_RIGHT_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_RIGHT_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=FINV(%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); aTemplate.setTemplate("=FINV(%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_LEFT_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_LEFT_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=1 - %P_RIGHT_TAIL_VALUE%"); aTemplate.setTemplate("=1 - %P_RIGHT_TAIL_VALUE%");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%P_LEFT_TAIL_VALUE%", aOutput.current()); aTemplate.autoReplaceAddress("%P_LEFT_TAIL_VALUE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_LEFT_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_LEFT_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=FINV(1-%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); aTemplate.setTemplate("=FINV(1-%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_TWO_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_TWO_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=2*MIN(%P_RIGHT_TAIL_VALUE%; %P_LEFT_TAIL_VALUE%)"); aTemplate.setTemplate("=2*MIN(%P_RIGHT_TAIL_VALUE%; %P_LEFT_TAIL_VALUE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_TWO_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_TWO_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
......
...@@ -81,22 +81,19 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -81,22 +81,19 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_UNDO_NAME)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_UNDO_NAME));
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString("Alpha"); aOutput.writeString("Alpha");
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeValue(0.05); aOutput.writeValue(0.05);
aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current()); aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL));
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL)); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL));
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -105,8 +102,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -105,8 +102,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)"); aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE));
aOutput.nextColumn(); aOutput.nextColumn();
...@@ -115,8 +111,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -115,8 +111,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=VAR(%VAR2_RANGE%)"); aTemplate.setTemplate("=VAR(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// Observations // Observations
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL));
...@@ -126,24 +121,21 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -126,24 +121,21 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)"); aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// Pearson Correlation // Pearson Correlation
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_PEARSON_CORRELATION)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_PEARSON_CORRELATION));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=CORREL(%VAR1_RANGE%;%VAR2_RANGE%)"); aTemplate.setTemplate("=CORREL(%VAR1_RANGE%;%VAR2_RANGE%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// Hypothesized mean difference // Hypothesized mean difference
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE));
aOutput.nextColumn(); aOutput.nextColumn();
aOutput.writeValue(2); aOutput.writeValue(2);
aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current()); aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// Observed mean difference // Observed mean difference
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_OBSERVED_MEAN_DIFFERENCE)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_OBSERVED_MEAN_DIFFERENCE));
...@@ -151,8 +143,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -151,8 +143,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))"); aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate()); aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current()); aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// Variance of the Differences // Variance of the Differences
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_VARIANCE_OF_THE_DIFFERENCES)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_VARIANCE_OF_THE_DIFFERENCES));
...@@ -160,8 +151,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -160,8 +151,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))"); aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))");
aOutput.writeMatrixFormula(aTemplate.getTemplate()); aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%VARIANCE_OF_DIFFERENCES%", aOutput.current()); aTemplate.autoReplaceAddress("%VARIANCE_OF_DIFFERENCES%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// df // df
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF));
...@@ -169,8 +159,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -169,8 +159,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)) - 1"); aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)) - 1");
aOutput.writeMatrixFormula(aTemplate.getTemplate()); aOutput.writeMatrixFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%DEGREE_OF_FREEDOM%", aOutput.current()); aTemplate.autoReplaceAddress("%DEGREE_OF_FREEDOM%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// t stat // t stat
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_STAT)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_STAT));
...@@ -178,39 +167,34 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) ...@@ -178,39 +167,34 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell)
aTemplate.setTemplate("=(%OBSERVED_MEAN_DIFFERENCE% - %HYPOTHESIZED_MEAN_DIFFERENCE%) / (%VARIANCE_OF_DIFFERENCES% / ( %DEGREE_OF_FREEDOM% + 1)) ^ 0.5"); aTemplate.setTemplate("=(%OBSERVED_MEAN_DIFFERENCE% - %HYPOTHESIZED_MEAN_DIFFERENCE%) / (%VARIANCE_OF_DIFFERENCES% / ( %DEGREE_OF_FREEDOM% + 1)) ^ 0.5");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aTemplate.autoReplaceAddress("%T_STAT%", aOutput.current()); aTemplate.autoReplaceAddress("%T_STAT%", aOutput.current());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// P one-tail // P one-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_ONE_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_ONE_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 1)"); aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 1)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// T critical one-tail // T critical one-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_ONE_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_ONE_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=TINV(2*0.05; %DEGREE_OF_FREEDOM%)"); aTemplate.setTemplate("=TINV(2*0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// P two-tail // P two-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_TWO_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_P_TWO_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 2)"); aTemplate.setTemplate("=TDIST(ABS(%T_STAT%); %DEGREE_OF_FREEDOM%; 2)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn(); aOutput.newLine();
aOutput.nextRow();
// T critical two-tail // T critical two-tail
aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_TWO_TAIL)); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_T_CRITICAL_TWO_TAIL));
aOutput.nextColumn(); aOutput.nextColumn();
aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)"); aTemplate.setTemplate("=TINV(0.05; %DEGREE_OF_FREEDOM%)");
aOutput.writeFormula(aTemplate.getTemplate()); aOutput.writeFormula(aTemplate.getTemplate());
aOutput.resetColumn();
return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress); return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress);
} }
......
...@@ -111,6 +111,12 @@ void AddressWalker::reset() ...@@ -111,6 +111,12 @@ void AddressWalker::reset()
mCurrentAddress = mAddressStack.back(); mCurrentAddress = mAddressStack.back();
} }
void AddressWalker::newLine()
{
resetColumn();
nextRow();
}
ScAddress AddressWalker::current(SCCOL aRelCol, SCROW aRelRow, SCTAB aRelTab) ScAddress AddressWalker::current(SCCOL aRelCol, SCROW aRelRow, SCTAB aRelTab)
{ {
return ScAddress( return ScAddress(
......
...@@ -64,12 +64,14 @@ public: ...@@ -64,12 +64,14 @@ public:
AddressWalker(ScAddress aInitialAddress, bool aTrackRange = true); AddressWalker(ScAddress aInitialAddress, bool aTrackRange = true);
ScAddress current(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0); ScAddress current(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
void reset();
void resetColumn(); void reset();
void resetRow(); void resetColumn();
void nextColumn(); void resetRow();
void nextRow(); void nextColumn();
void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0); void nextRow();
void newLine();
void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
}; };
class AddressWalkerWriter : public AddressWalker class AddressWalkerWriter : public AddressWalker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment