summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-07-22 18:35:07 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-23 20:52:45 +0200
commitba17605d5e75dc926c3f7c61795c77d855aa3458 (patch)
treefabd2a9533f295bfe175794855b6957e0afbae7d
parent19efbd8d9886e7a346b73aaabe644c56cb2a8e05 (diff)
Add ANOVA (analysis of variance) calculation to Statistics.
Currently supported calculation is one factor ANOVA calculation. Additionally refactor "descriptive statistics" and extract common functionallity with ANOVA into StatisticsInputOutput class. Change-Id: Ib9c3083019058c63738b3e92097411ba1b428648
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu8
-rw-r--r--sc/Library_sc.mk2
-rw-r--r--sc/UIConfig_scalc.mk1
-rw-r--r--sc/inc/sc.hrc3
-rw-r--r--sc/sdi/cellsh.sdi3
-rw-r--r--sc/sdi/scalc.sdi26
-rw-r--r--sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx318
-rw-r--r--sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx155
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx178
-rw-r--r--sc/source/ui/app/scdll.cxx1
-rw-r--r--sc/source/ui/inc/AnalysisOfVarianceDialog.hxx44
-rw-r--r--sc/source/ui/inc/DescriptiveStatisticsDialog.hxx48
-rw-r--r--sc/source/ui/inc/StatisticsInputOutputDialog.hxx82
-rw-r--r--sc/source/ui/inc/reffact.hxx22
-rw-r--r--sc/source/ui/view/cellsh.cxx11
-rw-r--r--sc/source/ui/view/cellsh1.cxx11
-rw-r--r--sc/source/ui/view/reffact.cxx12
-rw-r--r--sc/source/ui/view/tabvwsh.cxx1
-rw-r--r--sc/source/ui/view/tabvwshc.cxx19
-rw-r--r--sc/uiconfig/scalc/menubar/menubar.xml1
-rw-r--r--sc/uiconfig/scalc/ui/analysisofvariancedialog.ui226
21 files changed, 955 insertions, 217 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index fb8ed572e73a..e602c133dbd3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -653,6 +653,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:AnalysisOfVarianceDialog" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Analysis of Variance (ANOVA)...</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:EditHeaderAndFooter" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Headers &amp; Footers...</value>
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index c192566814e1..6db079494c73 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -476,6 +476,8 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog \
sc/source/ui/StatisticsDialogs/SamplingDialog \
sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog \
+ sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog \
+ sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog \
sc/source/ui/undo/areasave \
sc/source/ui/undo/refundo \
sc/source/ui/undo/target \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index f14e8dcb2985..06588d889280 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/scalc,\
$(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/advancedfilterdialog \
sc/uiconfig/scalc/ui/allheaderfooterdialog \
+ sc/uiconfig/scalc/ui/analysisofvariancedialog \
sc/uiconfig/scalc/ui/cellprotectionpage \
sc/uiconfig/scalc/ui/createnamesdialog \
sc/uiconfig/scalc/ui/dataform \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index d075e045d235..b552fa0882e3 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -252,9 +252,10 @@
#define SID_OPENDLG_ICONSET (SC_MESSAGE_START + 68)
#define SID_OPENDLG_CONDDATE (SC_MESSAGE_START + 69)
-#define SID_OPENDLG_RANDOM_NUMBER_GENERATOR (SC_MESSAGE_START + 70)
+#define SID_RANDOM_NUMBER_GENERATOR_DIALOG (SC_MESSAGE_START + 70)
#define SID_SAMPLING_DIALOG (SC_MESSAGE_START + 71)
#define SID_DESCRIPTIVE_STATISTICS_DIALOG (SC_MESSAGE_START + 72)
+#define SID_ANALYSIS_OF_VARIANCE_DIALOG (SC_MESSAGE_START + 73)
// functions
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 07fce83d1ae6..31ff7f0ebca4 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -147,9 +147,10 @@ interface CellSelection
FID_FILL_TAB [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
FID_FILL_SERIES [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
FID_FILL_AUTO [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
- SID_OPENDLG_RANDOM_NUMBER_GENERATOR [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
+ SID_RANDOM_NUMBER_GENERATOR_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_SAMPLING_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_DESCRIPTIVE_STATISTICS_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
+ SID_ANALYSIS_OF_VARIANCE_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_MARKDATAAREA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
SID_MARKARRAYFORMULA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
SID_SETINPUTMODE [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 7ac69ac9fb30..0a7c0ebd0a8e 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -2942,7 +2942,7 @@ SfxVoidItem GoalSeekDialog SID_OPENDLG_SOLVE
GroupId = GID_OPTIONS;
]
-SfxVoidItem RandomNumberGeneratorDialog SID_OPENDLG_RANDOM_NUMBER_GENERATOR
+SfxVoidItem RandomNumberGeneratorDialog SID_RANDOM_NUMBER_GENERATOR_DIALOG
()
[
/* flags: */
@@ -3014,6 +3014,30 @@ SfxVoidItem DescriptiveStatisticsDialog SID_DESCRIPTIVE_STATISTICS_DIALOG
GroupId = GID_OPTIONS;
]
+SfxVoidItem AnalysisOfVarianceDialog SID_ANALYSIS_OF_VARIANCE_DIALOG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
//--------------------------------------------------------------------------
SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER
()
diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
new file mode 100644
index 000000000000..cb00bac05615
--- /dev/null
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -0,0 +1,318 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/dispatch.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+
+#include "formulacell.hxx"
+#include "rangelst.hxx"
+#include "scitems.hxx"
+#include "docsh.hxx"
+#include "document.hxx"
+#include "uiitems.hxx"
+#include "reffact.hxx"
+#include "scresid.hxx"
+#include "random.hxx"
+#include "docfunc.hxx"
+#include "globstr.hrc"
+#include "sc.hrc"
+
+#include "AnalysisOfVarianceDialog.hxx"
+
+namespace
+{
+
+static const char* lclBasicStatisticsLabels[] =
+{
+ "Groups", "Count", "Sum", "Mean", "Variance", NULL
+};
+
+static const char* lclAnovaLabels[] =
+{
+ "Source of Variation", "SS", "df", "MS", "F", "P-value", "F critical", NULL
+};
+
+static const char* lclAnovaFormula[] =
+{
+ "=COUNT(%RANGE%)", "=SUM(%RANGE%)", "=AVERAGE(%RANGE%)", "=VAR(%RANGE%)", NULL
+};
+
+static const OUString lclWildcardRange("%RANGE%");
+
+OUString lclCreateMultiParameterFormula(
+ ScRangeList& aRangeList, const OUString& aFormulaTemplate,
+ const OUString& aWildcard, ScDocument* pDocument,
+ ScAddress::Details& aAddressDetails)
+{
+ OUString aResult;
+ for (size_t i = 0; i < aRangeList.size(); i++)
+ {
+ OUString aRangeString;
+ aRangeList[i]->Format( aRangeString, SCR_ABS, pDocument, aAddressDetails );
+ OUString aFormulaString = aFormulaTemplate.replaceAll(aWildcard, aRangeString);
+ aResult += aFormulaString;
+ if(i != aRangeList.size() - 1) // Not Last
+ aResult+= ";";
+ }
+ return aResult;
+}
+
+class CellAddressIterator
+{
+public:
+ CellAddressIterator(ScAddress& aStartAddress)
+ {}
+
+ virtual ~CellAddressIterator()
+ {}
+};
+
+}
+
+ScAnalysisOfVarianceDialog::ScAnalysisOfVarianceDialog(
+ SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow,
+ Window* pParent, ScViewData* pViewData ) :
+ ScStatisticsInputOutputDialog(
+ pSfxBindings, pChildWindow, pParent, pViewData,
+ "AnalysisOfVarianceDialog", "modules/scalc/ui/analysisofvariancedialog.ui" )
+{
+ get(mpAlpha, "alpha-spin");
+}
+
+ScAnalysisOfVarianceDialog::~ScAnalysisOfVarianceDialog()
+{}
+
+sal_Bool ScAnalysisOfVarianceDialog::Close()
+{
+ return DoClose( ScAnalysisOfVarianceDialogWrapper::GetChildWindowId() );
+}
+
+void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( )
+{
+ OUString aUndo("Analysis Of Variance");
+ ScDocShell* pDocShell = mViewData->GetDocShell();
+ svl::IUndoManager* pUndoManager = pDocShell->GetUndoManager();
+ pUndoManager->EnterListAction( aUndo, aUndo );
+
+ ScAddress aStart = mInputRange.aStart;
+ ScAddress aEnd = mInputRange.aEnd;
+
+ SCTAB outTab = mOutputAddress.Tab();
+ SCCOL outCol = mOutputAddress.Col();
+ SCROW outRow = mOutputAddress.Row();
+
+ OUString aReferenceString;
+ ScAddress aAddress;
+
+ for (SCROW inTab = aStart.Tab(); inTab <= aEnd.Tab(); inTab++)
+ {
+ outCol = mOutputAddress.Col();
+
+ // Write labels
+ for(sal_Int32 i = 0; lclBasicStatisticsLabels[i] != NULL; i++)
+ {
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aCalculationName(OUString::createFromAscii(lclBasicStatisticsLabels[i]));
+ pDocShell->GetDocFunc().SetStringCell(aAddress, aCalculationName, true);
+ outCol++;
+ }
+ outRow++;
+
+ ScRangeList aRangeList;
+
+ // Write statistic formulas for columns
+ for (SCCOL inCol = aStart.Col(); inCol <= aEnd.Col(); inCol++)
+ {
+ outCol = mOutputAddress.Col();
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aGroupName = OUString("Column ") + OUString::number(inCol - aStart.Col() + 1);
+ pDocShell->GetDocFunc().SetStringCell(aAddress, aGroupName, true);
+ outCol++;
+
+ ScRange aColumnRange (
+ ScAddress(inCol, aStart.Row(), inTab),
+ ScAddress(inCol, aEnd.Row(), inTab)
+ );
+ aRangeList.Append(aColumnRange);
+
+ aColumnRange.Format( aReferenceString, SCR_ABS, mDocument, mAddressDetails );
+ OUString aFormulaString;
+ OUString aFormulaTemplate;
+
+ for(sal_Int32 i = 0; lclAnovaFormula[i] != NULL; i++)
+ {
+ aAddress = ScAddress(outCol, outRow, outTab);
+ aFormulaTemplate = OUString::createFromAscii(lclAnovaFormula[i]);
+ aFormulaString = aFormulaTemplate.replaceAll(lclWildcardRange, aReferenceString);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+ }
+ outRow++;
+ }
+
+ outRow++; // Blank row
+
+ // Write ANOVA labels
+ outCol = mOutputAddress.Col();
+ for(sal_Int32 i = 0; lclAnovaLabels[i] != NULL; i++)
+ {
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aCalculationName(OUString::createFromAscii(lclAnovaLabels[i]));
+ pDocShell->GetDocFunc().SetStringCell(aAddress, aCalculationName, true);
+ outCol++;
+ }
+ outRow++;
+
+ // Between Groups
+ {
+ // Label
+ outCol = mOutputAddress.Col();
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetStringCell(aAddress, OUString("Between Groups"), true);
+ outCol++;
+
+ // Sum of Squares
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aReferenceTotal;
+ OUString aReferenceWithin;
+ ScAddress aAddressTotal(outCol, outRow+2, outTab);
+ aAddressTotal.Format( aReferenceTotal, SCR_ABS, mDocument, mAddressDetails );
+ ScAddress aAddressWithin(outCol, outRow+1, outTab);
+ aAddressWithin.Format( aReferenceWithin, SCR_ABS, mDocument, mAddressDetails );
+ OUString aFormulaString = "=" + aReferenceTotal + "-" + aReferenceWithin;
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+
+ // Degree of freedom
+ aAddress = ScAddress(outCol, outRow, outTab);
+ aAddressTotal = ScAddress(outCol, outRow+2, outTab);
+ aAddressTotal.Format( aReferenceTotal, SCR_ABS, mDocument, mAddressDetails );
+ aAddressWithin = ScAddress(outCol, outRow+1, outTab);
+ aAddressWithin.Format( aReferenceWithin, SCR_ABS, mDocument, mAddressDetails );
+ aFormulaString = "=" + aReferenceTotal + "-" + aReferenceWithin;
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+
+ // MS
+ OUString aSSRef;
+ ScAddress(outCol-2, outRow, outTab).Format( aSSRef, SCR_ABS, mDocument, mAddressDetails );
+ OUString aDFRef;
+ ScAddress(outCol-1, outRow, outTab).Format( aDFRef, SCR_ABS, mDocument, mAddressDetails );
+ aFormulaString = "=" + aSSRef + "/" + aDFRef;
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+
+ // F
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aMSBetween;
+ ScAddress(outCol-1, outRow, outTab).Format( aMSBetween, SCR_ABS, mDocument, mAddressDetails );
+ OUString aMSWithin;
+ ScAddress(outCol-1, outRow+1, outTab).Format( aMSWithin, SCR_ABS, mDocument, mAddressDetails );
+ aFormulaString = "=" + aMSBetween + "/" + aMSWithin;
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+
+ // P-value
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aFValue;
+ ScAddress(outCol-1, outRow, outTab).Format( aFValue, SCR_ABS, mDocument, mAddressDetails );
+ OUString aDFBetween;
+ ScAddress(outCol-3, outRow, outTab).Format( aDFBetween, SCR_ABS, mDocument, mAddressDetails );
+ OUString aDFWithin;
+ ScAddress(outCol-3, outRow+1, outTab).Format( aDFWithin, SCR_ABS, mDocument, mAddressDetails );
+ aFormulaString = "=FDIST("+ aFValue + ";" + aDFBetween + ";" + aDFWithin + ")";
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ outCol++;
+
+ // F critical
+ double aAlphaValue = mpAlpha->GetValue() / 100.0;
+ OUString aAlphaString = rtl::math::doubleToUString(
+ aAlphaValue, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep()[0], true);
+ aAddress = ScAddress(outCol, outRow, outTab);
+ aFormulaString = "=FINV(" + aAlphaString + ";" + aDFBetween + ";" + aDFWithin + ")";
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ }
+ outRow++;
+
+ // Within Groups
+ {
+ // Label
+ outCol = mOutputAddress.Col();
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetStringCell(aAddress, OUString("Within Groups"), true);
+ outCol++;
+
+ // Sum of Squares
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aSum("=SUM(%RANGE%)");
+ OUString aDevSQ("DEVSQ(%RANGE%)");
+ OUString aSSPart = lclCreateMultiParameterFormula(aRangeList, aDevSQ, lclWildcardRange, mDocument, mAddressDetails);
+ OUString aSS = aSum.replaceAll(lclWildcardRange, aSSPart);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aSS), true);
+ outCol++;
+
+ // Degree of freedom
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aCountMinusOne("COUNT(%RANGE%)-1");
+ OUString aDFPart = lclCreateMultiParameterFormula(aRangeList, aCountMinusOne, lclWildcardRange, mDocument, mAddressDetails);
+ OUString aDF = aSum.replaceAll(lclWildcardRange, aDFPart);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aDF), true);
+ outCol++;
+
+ // MS
+ OUString aSSRef;
+ OUString aDFRef;
+ ScAddress aAddressSS(outCol-2, outRow, outTab);
+ aAddressSS.Format( aSSRef, SCR_ABS, mDocument, mAddressDetails );
+ ScAddress aAddressDF(outCol-1, outRow, outTab);
+ aAddressDF.Format( aDFRef, SCR_ABS, mDocument, mAddressDetails );
+ OUString aFormulaString = "=" + aSSRef + "/" + aDFRef;
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
+ }
+ outRow++;
+
+ // Total
+ {
+ // Label
+ outCol = mOutputAddress.Col();
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetStringCell(aAddress, OUString("Total"), true);
+ outCol++;
+
+ // Sum of Squares
+ OUString aDevSQ("DEVSQ(%RANGE%)");
+ aRangeList.Format( aReferenceString, SCR_ABS, mDocument );
+ OUString aFormulaString = aDevSQ.replaceAll(lclWildcardRange, aReferenceString);
+
+ aAddress = ScAddress(outCol, outRow, outTab);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, "=" + aFormulaString), true);
+ outCol++;
+
+ // Degree of freedom
+ aAddress = ScAddress(outCol, outRow, outTab);
+ OUString aCount("COUNT(%RANGE%)");
+ OUString aSumMinusOne("=SUM(%RANGE%)-1");
+ OUString aDFPart = lclCreateMultiParameterFormula(aRangeList, aCount, lclWildcardRange, mDocument, mAddressDetails);
+ OUString aDF = aSumMinusOne.replaceAll(lclWildcardRange, aDFPart);
+ pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aDF), true);
+ }
+ outRow++;
+ }
+
+ ScRange aOutputRange(mOutputAddress, ScAddress(outTab, outRow, outTab) );
+ pUndoManager->LeaveListAction();
+ pDocShell->PostPaint( aOutputRange, PAINT_GRID );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
index a37d2edf6f23..ed9d57bc75a5 100644
--- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
@@ -55,124 +55,27 @@ static const StatisticCalculation lclCalcDefinitions[] =
{ 0, NULL }
};
+static const OUString lclWildcardRange("%RANGE%");
+
}
ScDescriptiveStatisticsDialog::ScDescriptiveStatisticsDialog(
SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow,
Window* pParent, ScViewData* pViewData ) :
- ScAnyRefDlg ( pSfxBindings, pChildWindow, pParent,
- "DescriptiveStatisticsDialog", "modules/scalc/ui/descriptivestatisticsdialog.ui" ),
- mViewData ( pViewData ),
- mDocument ( pViewData->GetDocument() ),
- mAddressDetails ( mDocument->GetAddressConvention(), 0, 0 ),
- mCurrentAddress ( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ),
- mDialogLostFocus( false )
-{
- get(mpInputRangeLabel, "input-range-label");
- get(mpInputRangeEdit, "input-range-edit");
- get(mpInputRangeButton, "input-range-button");
- mpInputRangeEdit->SetReferences(this, mpInputRangeLabel);
- mpInputRangeButton->SetReferences(this, mpInputRangeEdit);
-
- get(mpOutputRangeLabel, "output-range-label");
- get(mpOutputRangeEdit, "output-range-edit");
- get(mpOutputRangeButton, "output-range-button");
- mpOutputRangeEdit->SetReferences(this, mpOutputRangeLabel);
- mpOutputRangeButton->SetReferences(this, mpOutputRangeEdit);
-
- get(mpButtonOk, "ok");
- get(mpButtonApply, "apply");
- get(mpButtonClose, "close");
-
- Init();
- GetRangeFromSelection();
-}
-
-void ScDescriptiveStatisticsDialog::Init()
-{
- mpButtonOk->SetClickHdl( LINK( this, ScDescriptiveStatisticsDialog, OkClicked ) );
- mpButtonClose->SetClickHdl( LINK( this, ScDescriptiveStatisticsDialog, CloseClicked ) );
- mpButtonApply->SetClickHdl( LINK( this, ScDescriptiveStatisticsDialog, ApplyClicked ) );
- mpButtonOk->Enable(false);
- mpButtonApply->Enable(false);
-
- Link aLink = LINK( this, ScDescriptiveStatisticsDialog, GetFocusHandler );
- mpInputRangeEdit->SetGetFocusHdl( aLink );
- mpInputRangeButton->SetGetFocusHdl( aLink );
- mpOutputRangeEdit->SetGetFocusHdl( aLink );
- mpOutputRangeButton->SetGetFocusHdl( aLink );
-
- aLink = LINK( this, ScDescriptiveStatisticsDialog, LoseFocusHandler );
- mpInputRangeEdit->SetLoseFocusHdl( aLink );
- mpInputRangeButton->SetLoseFocusHdl( aLink );
- mpOutputRangeEdit->SetLoseFocusHdl( aLink );
- mpOutputRangeButton->SetLoseFocusHdl( aLink );
-
- mpOutputRangeEdit->GrabFocus();
-}
-
-void ScDescriptiveStatisticsDialog::GetRangeFromSelection()
-{
- OUString aCurrentString;
- mViewData->GetSimpleArea(mInputRange);
- mInputRange.Format(aCurrentString, SCR_ABS_3D, mDocument, mAddressDetails);
- mpInputRangeEdit->SetText(aCurrentString);
-}
+ ScStatisticsInputOutputDialog(
+ pSfxBindings, pChildWindow, pParent, pViewData,
+ "DescriptiveStatisticsDialog", "modules/scalc/ui/descriptivestatisticsdialog.ui" )
+{}
ScDescriptiveStatisticsDialog::~ScDescriptiveStatisticsDialog()
{}
-void ScDescriptiveStatisticsDialog::SetActive()
-{
- if ( mDialogLostFocus )
- {
- mDialogLostFocus = false;
- if( mpActiveEdit )
- mpActiveEdit->GrabFocus();
- }
- else
- {
- GrabFocus();
- }
- RefInputDone();
-}
-
sal_Bool ScDescriptiveStatisticsDialog::Close()
{
return DoClose( ScDescriptiveStatisticsDialogWrapper::GetChildWindowId() );
}
-void ScDescriptiveStatisticsDialog::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument )
-{
- if ( mpActiveEdit )
- {
- if ( rReferenceRange.aStart != rReferenceRange.aEnd )
- RefInputStart( mpActiveEdit );
-
- String aReferenceString;
-
- if ( mpActiveEdit == mpInputRangeEdit )
- {
- mInputRange = rReferenceRange;
- mInputRange.Format( aReferenceString, SCR_ABS_3D, pDocument, mAddressDetails );
- mpInputRangeEdit->SetRefString( aReferenceString );
- }
- else if ( mpActiveEdit == mpOutputRangeEdit )
- {
- mOutputAddress = rReferenceRange.aStart;
-
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
- mOutputAddress.Format( aReferenceString, nFormat, pDocument, pDocument->GetAddressConvention() );
- mpOutputRangeEdit->SetRefString( aReferenceString );
-
- // Enable OK, Cancel if output range is set
- mpButtonOk->Enable(!mpOutputRangeEdit->GetText().isEmpty());
- mpButtonApply->Enable(!mpOutputRangeEdit->GetText().isEmpty());
- }
- }
-}
-
-void ScDescriptiveStatisticsDialog::ApplyCalculationsFormulas( )
+void ScDescriptiveStatisticsDialog::CalculateInputAndWriteToOutput( )
{
OUString aUndo(SC_RESSTR(STR_DESCRIPTIVE_STATISTICS_UNDO_NAME));
ScDocShell* pDocShell = mViewData->GetDocShell();
@@ -211,7 +114,6 @@ void ScDescriptiveStatisticsDialog::ApplyCalculationsFormulas( )
);
aColumnRange.Format( aReferenceString, SCR_ABS, mDocument, mAddressDetails );
- OUString sRange("%RANGE%");
OUString aFormulaString;
OUString aFormulaTemplate;
@@ -219,7 +121,7 @@ void ScDescriptiveStatisticsDialog::ApplyCalculationsFormulas( )
{
aAddress = ScAddress(outCol, outRow, outTab);
aFormulaTemplate = OUString::createFromAscii(lclCalcDefinitions[i].aFormula);
- aFormulaString = aFormulaTemplate.replaceAll(sRange, aReferenceString);
+ aFormulaString = aFormulaTemplate.replaceAll(lclWildcardRange, aReferenceString);
pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true);
outRow++;
}
@@ -233,45 +135,4 @@ void ScDescriptiveStatisticsDialog::ApplyCalculationsFormulas( )
pDocShell->PostPaint( aOutputRange, PAINT_GRID );
}
-IMPL_LINK( ScDescriptiveStatisticsDialog, OkClicked, PushButton*, /*pButton*/ )
-{
- ApplyClicked(NULL);
- CloseClicked(NULL);
- return 0;
-}
-
-
-IMPL_LINK( ScDescriptiveStatisticsDialog, ApplyClicked, PushButton*, /*pButton*/ )
-{
- ApplyCalculationsFormulas();
- return 0;
-}
-
-IMPL_LINK( ScDescriptiveStatisticsDialog, CloseClicked, PushButton*, /*pButton*/ )
-{
- Close();
- return 0;
-}
-
-IMPL_LINK( ScDescriptiveStatisticsDialog, GetFocusHandler, Control*, pCtrl )
-{
- mpActiveEdit = NULL;
-
- if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) mpInputRangeButton) )
- mpActiveEdit = mpInputRangeEdit;
- else if( (pCtrl == (Control*) mpOutputRangeEdit) || (pCtrl == (Control*) mpOutputRangeButton) )
- mpActiveEdit = mpOutputRangeEdit;
-
- if( mpActiveEdit )
- mpActiveEdit->SetSelection( Selection( 0, SELECTION_MAX ) );
-
- return 0;
-}
-
-IMPL_LINK_NOARG(ScDescriptiveStatisticsDialog, LoseFocusHandler)
-{
- mDialogLostFocus = !IsActive();
- return 0;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
new file mode 100644
index 000000000000..7a01131d176f
--- /dev/null
+++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <sfx2/dispatch.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+
+#include "formulacell.hxx"
+#include "rangelst.hxx"
+#include "scitems.hxx"
+#include "docsh.hxx"
+#include "document.hxx"
+#include "uiitems.hxx"
+#include "reffact.hxx"
+#include "scresid.hxx"
+#include "random.hxx"
+#include "docfunc.hxx"
+
+#include "StatisticsInputOutputDialog.hxx"
+
+ScStatisticsInputOutputDialog::ScStatisticsInputOutputDialog(
+ SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow,
+ Window* pParent, ScViewData* pViewData, const OString& rID, const OUString& rUIXMLDescription ) :
+ ScAnyRefDlg ( pSfxBindings, pChildWindow, pParent, rID, rUIXMLDescription ),
+ mViewData ( pViewData ),
+ mDocument ( pViewData->GetDocument() ),
+ mAddressDetails ( mDocument->GetAddressConvention(), 0, 0 ),
+ mCurrentAddress ( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ),
+ mDialogLostFocus( false )
+{
+ get(mpInputRangeLabel, "input-range-label");
+ get(mpInputRangeEdit, "input-range-edit");
+ get(mpInputRangeButton, "input-range-button");
+ mpInputRangeEdit->SetReferences(this, mpInputRangeLabel);
+ mpInputRangeButton->SetReferences(this, mpInputRangeEdit);
+
+ get(mpOutputRangeLabel, "output-range-label");
+ get(mpOutputRangeEdit, "output-range-edit");
+ get(mpOutputRangeButton, "output-range-button");
+ mpOutputRangeEdit->SetReferences(this, mpOutputRangeLabel);
+ mpOutputRangeButton->SetReferences(this, mpOutputRangeEdit);
+
+ get(mpButtonOk, "ok");
+ get(mpButtonApply, "apply");
+ get(mpButtonClose, "close");
+
+ Init();
+ GetRangeFromSelection();
+}
+
+ScStatisticsInputOutputDialog::~ScStatisticsInputOutputDialog()
+{}
+
+void ScStatisticsInputOutputDialog::Init()
+{
+ mpButtonOk->SetClickHdl( LINK( this, ScStatisticsInputOutputDialog, OkClicked ) );
+ mpButtonClose->SetClickHdl( LINK( this, ScStatisticsInputOutputDialog, CloseClicked ) );
+ mpButtonApply->SetClickHdl( LINK( this, ScStatisticsInputOutputDialog, ApplyClicked ) );
+ mpButtonOk->Enable(false);
+ mpButtonApply->Enable(false);
+
+ Link aLink = LINK( this, ScStatisticsInputOutputDialog, GetFocusHandler );
+ mpInputRangeEdit->SetGetFocusHdl( aLink );
+ mpInputRangeButton->SetGetFocusHdl( aLink );
+ mpOutputRangeEdit->SetGetFocusHdl( aLink );
+ mpOutputRangeButton->SetGetFocusHdl( aLink );
+
+ aLink = LINK( this, ScStatisticsInputOutputDialog, LoseFocusHandler );
+ mpInputRangeEdit->SetLoseFocusHdl( aLink );
+ mpInputRangeButton->SetLoseFocusHdl( aLink );
+ mpOutputRangeEdit->SetLoseFocusHdl( aLink );
+ mpOutputRangeButton->SetLoseFocusHdl( aLink );
+
+ mpOutputRangeEdit->GrabFocus();
+}
+
+void ScStatisticsInputOutputDialog::GetRangeFromSelection()
+{
+ OUString aCurrentString;
+ mViewData->GetSimpleArea(mInputRange);
+ mInputRange.Format(aCurrentString, SCR_ABS_3D, mDocument, mAddressDetails);
+ mpInputRangeEdit->SetText(aCurrentString);
+}
+
+void ScStatisticsInputOutputDialog::SetActive()
+{
+ if ( mDialogLostFocus )
+ {
+ mDialogLostFocus = false;
+ if( mpActiveEdit )
+ mpActiveEdit->GrabFocus();
+ }
+ else
+ {
+ GrabFocus();
+ }
+ RefInputDone();
+}
+
+void ScStatisticsInputOutputDialog::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument )
+{
+ if ( mpActiveEdit )
+ {
+ if ( rReferenceRange.aStart != rReferenceRange.aEnd )
+ RefInputStart( mpActiveEdit );
+
+ String aReferenceString;
+
+ if ( mpActiveEdit == mpInputRangeEdit )
+ {
+ mInputRange = rReferenceRange;
+ mInputRange.Format( aReferenceString, SCR_ABS_3D, pDocument, mAddressDetails );
+ mpInputRangeEdit->SetRefString( aReferenceString );
+ }
+ else if ( mpActiveEdit == mpOutputRangeEdit )
+ {
+ mOutputAddress = rReferenceRange.aStart;
+
+ sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ mOutputAddress.Format( aReferenceString, nFormat, pDocument, pDocument->GetAddressConvention() );
+ mpOutputRangeEdit->SetRefString( aReferenceString );
+
+ // Enable OK, Cancel if output range is set
+ mpButtonOk->Enable(!mpOutputRangeEdit->GetText().isEmpty());
+ mpButtonApply->Enable(!mpOutputRangeEdit->GetText().isEmpty());
+ }
+ }
+}
+
+IMPL_LINK( ScStatisticsInputOutputDialog, OkClicked, PushButton*, /*pButton*/ )
+{
+ ApplyClicked(NULL);
+ CloseClicked(NULL);
+ return 0;
+}
+
+
+IMPL_LINK( ScStatisticsInputOutputDialog, ApplyClicked, PushButton*, /*pButton*/ )
+{
+ CalculateInputAndWriteToOutput();
+ return 0;
+}
+
+IMPL_LINK( ScStatisticsInputOutputDialog, CloseClicked, PushButton*, /*pButton*/ )
+{
+ Close();
+ return 0;
+}
+
+IMPL_LINK( ScStatisticsInputOutputDialog, GetFocusHandler, Control*, pCtrl )
+{
+ mpActiveEdit = NULL;
+
+ if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) mpInputRangeButton) )
+ mpActiveEdit = mpInputRangeEdit;
+ else if( (pCtrl == (Control*) mpOutputRangeEdit) || (pCtrl == (Control*) mpOutputRangeButton) )
+ mpActiveEdit = mpOutputRangeEdit;
+
+ if( mpActiveEdit )
+ mpActiveEdit->SetSelection( Selection( 0, SELECTION_MAX ) );
+
+ return 0;
+}
+
+IMPL_LINK_NOARG( ScStatisticsInputOutputDialog, LoseFocusHandler )
+{
+ mDialogLostFocus = !IsActive();
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 02ef88bfb86f..e0b4489a8744 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -270,6 +270,7 @@ void ScDLL::Init()
ScRandomNumberGeneratorDialogWrapper::RegisterChildWindow(false, pMod);
ScSamplingDialogWrapper ::RegisterChildWindow(false, pMod);
ScDescriptiveStatisticsDialogWrapper::RegisterChildWindow(false, pMod);
+ ScAnalysisOfVarianceDialogWrapper ::RegisterChildWindow(false, pMod);
// First docking Window for Calc
ScFunctionChildWindow ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx
new file mode 100644
index 000000000000..366c02ad3912
--- /dev/null
+++ b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef ANOVA_ONE_FACTOR_DIALOG_HXX
+#define ANOVA_ONE_FACTOR_DIALOG_HXX
+
+#include "global.hxx"
+#include "address.hxx"
+#include "anyrefdg.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+
+#include "StatisticsInputOutputDialog.hxx"
+
+class ScAnalysisOfVarianceDialog : public ScStatisticsInputOutputDialog
+{
+public:
+ ScAnalysisOfVarianceDialog(
+ SfxBindings* pB, SfxChildWindow* pCW,
+ Window* pParent, ScViewData* pViewData );
+
+ virtual ~ScAnalysisOfVarianceDialog();
+
+ virtual sal_Bool Close();
+
+ NumericField* mpAlpha;
+
+protected:
+ virtual void CalculateInputAndWriteToOutput();
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx
index c375d27158ff..b2003b6b5191 100644
--- a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx
+++ b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx
@@ -19,7 +19,9 @@
#include <vcl/group.hxx>
#include <vcl/lstbox.hxx>
-class ScDescriptiveStatisticsDialog : public ScAnyRefDlg
+#include "StatisticsInputOutputDialog.hxx"
+
+class ScDescriptiveStatisticsDialog : public ScStatisticsInputOutputDialog
{
public:
ScDescriptiveStatisticsDialog(
@@ -28,48 +30,10 @@ public:
virtual ~ScDescriptiveStatisticsDialog();
- virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
- virtual void SetActive();
- virtual sal_Bool Close();
-
-private:
- // Widgets
- FixedText* mpInputRangeLabel;
- formula::RefEdit* mpInputRangeEdit;
- formula::RefButton* mpInputRangeButton;
-
- FixedText* mpOutputRangeLabel;
- formula::RefEdit* mpOutputRangeEdit;
- formula::RefButton* mpOutputRangeButton;
-
- PushButton* mpButtonApply;
- OKButton* mpButtonOk;
- CloseButton* mpButtonClose;
-
- //
- formula::RefEdit* mpActiveEdit;
-
- // Data
- ScViewData* mViewData;
- ScDocument* mDocument;
-
- ScRange mInputRange;
- ScAddress::Details mAddressDetails;
- ScAddress mOutputAddress;
-
- ScAddress mCurrentAddress;
-
- bool mDialogLostFocus;
-
- void Init();
- void GetRangeFromSelection();
- void ApplyCalculationsFormulas();
+ virtual sal_Bool Close();
- DECL_LINK( OkClicked, PushButton* );
- DECL_LINK( CloseClicked, PushButton* );
- DECL_LINK( ApplyClicked, PushButton* );
- DECL_LINK( GetFocusHandler, Control* );
- DECL_LINK( LoseFocusHandler, void* );
+protected:
+ virtual void CalculateInputAndWriteToOutput();
};
#endif
diff --git a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx
new file mode 100644
index 000000000000..4d0c0bbc9533
--- /dev/null
+++ b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef STATISTICS_INPUT_OUTPUT_DIALOG_HXX
+#define STATISTICS_INPUT_OUTPUT_DIALOG_HXX
+
+#include "global.hxx"
+#include "address.hxx"
+#include "anyrefdg.hxx"
+
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+
+class ScStatisticsInputOutputDialog : public ScAnyRefDlg
+{
+public:
+ ScStatisticsInputOutputDialog(
+ SfxBindings* pB, SfxChildWindow* pCW,
+ Window* pParent, ScViewData* pViewData,
+ const OString& rID, const OUString& rUIXMLDescription );
+
+ virtual ~ScStatisticsInputOutputDialog();
+
+ virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
+ virtual void SetActive();
+
+protected:
+ virtual void CalculateInputAndWriteToOutput() = 0;
+
+ // Widgets
+ FixedText* mpInputRangeLabel;
+ formula::RefEdit* mpInputRangeEdit;
+ formula::RefButton* mpInputRangeButton;
+
+ FixedText* mpOutputRangeLabel;
+ formula::RefEdit* mpOutputRangeEdit;
+ formula::RefButton* mpOutputRangeButton;
+
+ // Data
+ ScViewData* mViewData;
+ ScDocument* mDocument;
+
+ ScRange mInputRange;
+ ScAddress::Details mAddressDetails;
+ ScAddress mOutputAddress;
+
+private:
+ // Widgets
+ PushButton* mpButtonApply;
+ OKButton* mpButtonOk;
+ CloseButton* mpButtonClose;
+
+
+ formula::RefEdit* mpActiveEdit;
+
+
+ ScAddress mCurrentAddress;
+
+ bool mDialogLostFocus;
+
+ void Init();
+ void GetRangeFromSelection();
+
+ DECL_LINK( OkClicked, PushButton* );
+ DECL_LINK( CloseClicked, PushButton* );
+ DECL_LINK( ApplyClicked, PushButton* );
+ DECL_LINK( GetFocusHandler, Control* );
+ DECL_LINK( LoseFocusHandler, void* );
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index b0490f373efc..eb131e3cfcb3 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -21,9 +21,12 @@
#define SC_REFFACT_HXX
#include <sfx2/childwin.hxx>
+#include "ChildWindowWrapper.hxx"
#include "dbfunc.hxx"
+#include "sc.hrc"
+
#define DECL_WRAPPER_WITHID(Class) \
class Class : public SfxChildWindow \
{ \
@@ -50,9 +53,22 @@ DECL_WRAPPER_WITHID(ScColRowNameRangesDlgWrapper)
DECL_WRAPPER_WITHID(ScFormulaDlgWrapper)
DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper)
-DECL_WRAPPER_WITHID(ScRandomNumberGeneratorDialogWrapper)
-DECL_WRAPPER_WITHID(ScSamplingDialogWrapper)
-DECL_WRAPPER_WITHID(ScDescriptiveStatisticsDialogWrapper)
+class ScDescriptiveStatisticsDialogWrapper :
+ public ChildWindowWrapper<SID_DESCRIPTIVE_STATISTICS_DIALOG>
+{};
+
+class ScSamplingDialogWrapper :
+ public ChildWindowWrapper<SID_SAMPLING_DIALOG>
+{};
+
+class ScRandomNumberGeneratorDialogWrapper :
+ public ChildWindowWrapper<SID_RANDOM_NUMBER_GENERATOR_DIALOG>
+{};
+
+class ScAnalysisOfVarianceDialogWrapper :
+ public ChildWindowWrapper<SID_ANALYSIS_OF_VARIANCE_DIALOG>
+{};
+
class ScAcceptChgDlgWrapper: public SfxChildWindow
{
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 8a248143242f..85a750650ea7 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -170,10 +170,17 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
}
}
break;
- case FID_FILL_SERIES: // fill block
- case SID_OPENDLG_RANDOM_NUMBER_GENERATOR:
+
+ case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
case SID_SAMPLING_DIALOG:
case SID_DESCRIPTIVE_STATISTICS_DIALOG:
+ case SID_ANALYSIS_OF_VARIANCE_DIALOG:
+ {
+ bDisable = !bSimpleArea;
+ }
+ break;
+
+ case FID_FILL_SERIES: // fill block
case SID_OPENDLG_TABOP: // multiple-cell operations, are at least 2 cells marked?
if (pDoc->GetChangeTrack()!=NULL &&nWhich ==SID_OPENDLG_TABOP)
bDisable = sal_True;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 829269be546a..3e7ff8b44bb6 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -903,7 +903,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
}
break;
- case SID_OPENDLG_RANDOM_NUMBER_GENERATOR:
+ case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
{
sal_uInt16 nId = ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
@@ -930,6 +930,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
}
break;
+ case SID_ANALYSIS_OF_VARIANCE_DIALOG:
+ {
+ sal_uInt16 nId = ScAnalysisOfVarianceDialogWrapper::GetChildWindowId();
+ SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+ SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+
+ pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
+ }
+ break;
//
// disposal (Outlines)
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 7de5b00bda05..7c196be365ca 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -51,11 +51,6 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScRandomNumberGeneratorDialogWrapper, SID_OPENDLG_RANDOM_NUMBER_GENERATOR )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScSamplingDialogWrapper, SID_SAMPLING_DIALOG )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScDescriptiveStatisticsDialogWrapper, SID_DESCRIPTIVE_STATISTICS_DIALOG )
-
-
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
SfxChildWinInfo ScValidityRefChildWin::GetInfo() const
@@ -130,13 +125,6 @@ IMPL_CHILD_CTOR( ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
IMPL_CHILD_CTOR( ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
-IMPL_CHILD_CTOR( ScRandomNumberGeneratorDialogWrapper, SID_OPENDLG_RANDOM_NUMBER_GENERATOR )
-
-IMPL_CHILD_CTOR( ScSamplingDialogWrapper, SID_SAMPLING_DIALOG )
-
-IMPL_CHILD_CTOR( ScDescriptiveStatisticsDialogWrapper, SID_DESCRIPTIVE_STATISTICS_DIALOG )
-
-
//-------------------------------------------------------------------------
// ScSimpleRefDlgWrapper
//-------------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 79e9d3ac747e..02999e14bc45 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -84,6 +84,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_REGISTRATION(ScRandomNumberGeneratorDialogWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScSamplingDialogWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScDescriptiveStatisticsDialogWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(ScAnalysisOfVarianceDialogWrapper::GetChildWindowId());
}
SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index ded42d12cfd6..a55d676a2a04 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -64,6 +64,8 @@
#include "RandomNumberGeneratorDialog.hxx"
#include "SamplingDialog.hxx"
#include "DescriptiveStatisticsDialog.hxx"
+#include "AnalysisOfVarianceDialog.hxx"
+
//------------------------------------------------------------------
@@ -315,24 +317,27 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
- case SID_OPENDLG_RANDOM_NUMBER_GENERATOR:
+ case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
{
- ScViewData* pViewData = GetViewData();
- pResult = new ScRandomNumberGeneratorDialog( pB, pCW, pParent, pViewData );
+ pResult = new ScRandomNumberGeneratorDialog( pB, pCW, pParent, GetViewData() );
}
break;
case SID_SAMPLING_DIALOG:
{
- ScViewData* pViewData = GetViewData();
- pResult = new ScSamplingDialog( pB, pCW, pParent, pViewData );
+ pResult = new ScSamplingDialog( pB, pCW, pParent, GetViewData() );
}
break;
case SID_DESCRIPTIVE_STATISTICS_DIALOG:
{
- ScViewData* pViewData = GetViewData();
- pResult = new ScDescriptiveStatisticsDialog( pB, pCW, pParent, pViewData );
+ pResult = new ScDescriptiveStatisticsDialog( pB, pCW, pParent, GetViewData() );
+ }
+ break;
+
+ case SID_ANALYSIS_OF_VARIANCE_DIALOG:
+ {
+ pResult = new ScAnalysisOfVarianceDialog( pB, pCW, pParent, GetViewData() );
}
break;
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 90412ea3ea08..b2177025f3a2 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -478,6 +478,7 @@
<menu:menupopup>
<menu:menuitem menu:id=".uno:SamplingDialog"/>
<menu:menuitem menu:id=".uno:DescriptiveStatisticsDialog"/>
+ <menu:menuitem menu:id=".uno:AnalysisOfVarianceDialog"/>
</menu:menupopup>
</menu:menu>
</menu:menupopup>
diff --git a/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui b/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui
new file mode 100644
index 000000000000..d2ed1792c5c2
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkAdjustment" id="alpha-adjustment">
+ <property name="lower">0.01</property>
+ <property name="upper">0.98999999999999999</property>
+ <property name="value">0.050000000000000003</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.050000000000000003</property>
+ </object>
+ <object class="GtkDialog" id="AnalysisOfVarianceDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Descriptive Statistics</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="apply">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <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="input-range-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Input Range</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">input-range-edit</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="foruilo-RefEdit" id="input-range-edit">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">•</property>
+ <property name="width_chars">30</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="foruilo-RefButton" id="input-range-button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="output-range-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Output Range</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">output-range-edit</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="foruilo-RefEdit" id="output-range-edit">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">•</property>
+ <property name="width_chars">30</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="foruilo-RefButton" id="output-range-button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="alpha-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Alpha</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">alpha-spin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="alpha-spin">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="invisible_char">•</property>
+ <property name="adjustment">alpha-adjustment</property>
+ <property name="digits">2</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">apply</action-widget>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">close</action-widget>
+ </action-widgets>
+ </object>
+</interface>