sc: Convert ScStatisticsInputOutputDialog::GroupedBy to enum class
Change-Id: I9d05b948caf6d35c9134d26b842fd66c1d41626a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208093 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -68,10 +68,11 @@ OUString lclCreateMultiParameterFormula(
|
||||
return aResult.makeStringAndClear();
|
||||
}
|
||||
|
||||
void lclMakeSubRangesList(ScRangeList& rRangeList, const ScRange& rInputRange, ScStatisticsInputOutputDialog::GroupedBy aGroupedBy)
|
||||
void lclMakeSubRangesList(ScRangeList& rRangeList, const ScRange& rInputRange,
|
||||
ScStatisticsInputOutputDialog::GroupedBy eGroupedBy)
|
||||
{
|
||||
std::unique_ptr<DataRangeIterator> pIterator;
|
||||
if (aGroupedBy == ScStatisticsInputOutputDialog::BY_COLUMN)
|
||||
if (eGroupedBy == ScStatisticsInputOutputDialog::GroupedBy::ByColumn)
|
||||
pIterator.reset(new DataRangeByColumnIterator(rInputRange));
|
||||
else
|
||||
pIterator.reset(new DataRangeByRowIterator(rInputRange));
|
||||
@@ -164,7 +165,8 @@ void ScAnalysisOfVarianceDialog::RowColumn(ScRangeList& rRangeList, AddressWalke
|
||||
}
|
||||
else
|
||||
{
|
||||
TranslateId pLabelId = (aGroupedBy == BY_COLUMN) ? STR_COLUMN_LABEL_TEMPLATE : STR_ROW_LABEL_TEMPLATE;
|
||||
TranslateId pLabelId = (aGroupedBy == GroupedBy::ByColumn) ? STR_COLUMN_LABEL_TEMPLATE
|
||||
: STR_ROW_LABEL_TEMPLATE;
|
||||
OUString aLabelTemplate(ScResId(pLabelId));
|
||||
|
||||
for (size_t i = 0; i < rRangeList.size(); i++)
|
||||
@@ -350,8 +352,8 @@ void ScAnalysisOfVarianceDialog::AnovaTwoFactor(AddressWalkerWriter& output, For
|
||||
ScRangeList aColumnRangeList;
|
||||
ScRangeList aRowRangeList;
|
||||
|
||||
lclMakeSubRangesList(aColumnRangeList, mInputRange, BY_COLUMN);
|
||||
lclMakeSubRangesList(aRowRangeList, mInputRange, BY_ROW);
|
||||
lclMakeSubRangesList(aColumnRangeList, mInputRange, GroupedBy::ByColumn);
|
||||
lclMakeSubRangesList(aRowRangeList, mInputRange, GroupedBy::ByRow);
|
||||
|
||||
// Write ColumnX values
|
||||
output.push();
|
||||
@@ -360,7 +362,8 @@ void ScAnalysisOfVarianceDialog::AnovaTwoFactor(AddressWalkerWriter& output, For
|
||||
output.resetRow();
|
||||
ScRange aResultRange;
|
||||
OUString sFormula = OUString::createFromAscii(lclBasicStatistics[i].aFormula);
|
||||
RowColumn(aColumnRangeList, output, aTemplate, sFormula, BY_COLUMN, &aResultRange);
|
||||
RowColumn(aColumnRangeList, output, aTemplate, sFormula, GroupedBy::ByColumn,
|
||||
&aResultRange);
|
||||
if (lclBasicStatistics[i].aResultRangeName != nullptr)
|
||||
{
|
||||
OUString sResultRangeName = OUString::createFromAscii(lclBasicStatistics[i].aResultRangeName);
|
||||
@@ -377,7 +380,7 @@ void ScAnalysisOfVarianceDialog::AnovaTwoFactor(AddressWalkerWriter& output, For
|
||||
output.resetRow();
|
||||
ScRange aResultRange;
|
||||
OUString sFormula = OUString::createFromAscii(lclBasicStatistics[i].aFormula);
|
||||
RowColumn(aRowRangeList, output, aTemplate, sFormula, BY_ROW, &aResultRange);
|
||||
RowColumn(aRowRangeList, output, aTemplate, sFormula, GroupedBy::ByRow, &aResultRange);
|
||||
|
||||
if (lclBasicStatistics[i].aResultRangeName != nullptr)
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
FormulaTemplate aTemplate(&mDocument);
|
||||
|
||||
std::unique_ptr<DataRangeIterator> pIterator;
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
pIterator.reset(new DataRangeByColumnIterator(mInputRange));
|
||||
else
|
||||
pIterator.reset(new DataRangeByRowIterator(mInputRange));
|
||||
@@ -92,7 +92,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
OUString aColRowLabel = mDocument.GetString(pIterator->get().aStart);
|
||||
if (aColRowLabel.isEmpty())
|
||||
{
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
|
||||
else
|
||||
aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
|
||||
|
||||
@@ -63,7 +63,7 @@ ScRange ScExponentialSmoothingDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
output.push();
|
||||
|
||||
std::unique_ptr<DataRangeIterator> pIterator;
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
pIterator.reset(new DataRangeByColumnIterator(mInputRange));
|
||||
else
|
||||
pIterator.reset(new DataRangeByRowIterator(mInputRange));
|
||||
@@ -75,7 +75,7 @@ ScRange ScExponentialSmoothingDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
ScRange aCurrentRange = pIterator->get();
|
||||
|
||||
// Write column label
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
|
||||
else
|
||||
aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
|
||||
|
||||
@@ -114,7 +114,7 @@ bool ScFourierAnalysisDialog::InputRangesValid()
|
||||
|
||||
mInputRange.PutInOrder();
|
||||
|
||||
mbGroupedByColumn = mGroupedBy == BY_COLUMN;
|
||||
mbGroupedByColumn = mGroupedBy == GroupedBy::ByColumn;
|
||||
mbWithLabels = mxWithLabelsCheckBox->get_active();
|
||||
|
||||
mbUse3DAddresses = mInputRange.aStart.Tab() != mOutputAddress.Tab();
|
||||
|
||||
@@ -63,9 +63,9 @@ ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell)
|
||||
|
||||
SCTAB inTab = mInputRange.aStart.Tab();
|
||||
|
||||
ScRangeList aRangeList = (mGroupedBy == BY_COLUMN) ?
|
||||
MakeColumnRangeList(inTab, mInputRange.aStart, mInputRange.aEnd) :
|
||||
MakeRowRangeList(inTab, mInputRange.aStart, mInputRange.aEnd);
|
||||
ScRangeList aRangeList = (mGroupedBy == GroupedBy::ByColumn)
|
||||
? MakeColumnRangeList(inTab, mInputRange.aStart, mInputRange.aEnd)
|
||||
: MakeRowRangeList(inTab, mInputRange.aStart, mInputRange.aEnd);
|
||||
|
||||
// labels
|
||||
output.writeString(getLabel());
|
||||
@@ -76,7 +76,7 @@ ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell)
|
||||
// write labels to columns
|
||||
for (size_t i = 0; i < aRangeList.size(); i++)
|
||||
{
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
|
||||
else
|
||||
aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
|
||||
@@ -91,7 +91,7 @@ ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell)
|
||||
output.nextRow();
|
||||
for (size_t i = 0; i < aRangeList.size(); i++)
|
||||
{
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
|
||||
else
|
||||
aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
|
||||
|
||||
@@ -52,7 +52,7 @@ ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
mDocument.GetDataAreaSubrange(mInputRange);
|
||||
|
||||
std::unique_ptr<DataRangeIterator> pIterator;
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
pIterator.reset(new DataRangeByColumnIterator(mInputRange));
|
||||
else
|
||||
pIterator.reset(new DataRangeByRowIterator(mInputRange));
|
||||
@@ -65,7 +65,7 @@ ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell)
|
||||
output.resetRow();
|
||||
|
||||
// Write label
|
||||
if (mGroupedBy == BY_COLUMN)
|
||||
if (mGroupedBy == GroupedBy::ByColumn)
|
||||
aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
|
||||
else
|
||||
aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
|
||||
|
||||
@@ -64,7 +64,7 @@ ScStatisticsInputOutputDialog::ScStatisticsInputOutputDialog(
|
||||
, mInputRange(ScAddress::INITIALIZE_INVALID)
|
||||
, mAddressDetails(mDocument.GetAddressConvention(), 0, 0)
|
||||
, mOutputAddress(ScAddress::INITIALIZE_INVALID)
|
||||
, mGroupedBy(BY_COLUMN)
|
||||
, mGroupedBy(GroupedBy::ByColumn)
|
||||
, mxButtonOk(m_xBuilder->weld_button(u"ok"_ustr))
|
||||
, mxButtonCancel(m_xBuilder->weld_button(u"cancel"_ustr))
|
||||
, mpActiveEdit(nullptr)
|
||||
@@ -220,9 +220,9 @@ IMPL_LINK_NOARG(ScStatisticsInputOutputDialog, LoseButtonFocusHandler, formula::
|
||||
IMPL_LINK_NOARG( ScStatisticsInputOutputDialog, GroupByChanged, weld::Toggleable&, void )
|
||||
{
|
||||
if (mxGroupByColumnsRadio->get_active())
|
||||
mGroupedBy = BY_COLUMN;
|
||||
mGroupedBy = GroupedBy::ByColumn;
|
||||
else if (mxGroupByRowsRadio->get_active())
|
||||
mGroupedBy = BY_ROW;
|
||||
mGroupedBy = GroupedBy::ByRow;
|
||||
|
||||
ValidateDialogInput();
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ private:
|
||||
std::unique_ptr<weld::SpinButton> mxRowsPerSampleField;
|
||||
|
||||
static void RowColumn(ScRangeList& rRangeList, AddressWalkerWriter& aOutput,
|
||||
FormulaTemplate& aTemplate, const OUString& sFormula,
|
||||
GroupedBy aGroupedBy, ScRange* pResultRange);
|
||||
FormulaTemplate& aTemplate, const OUString& sFormula,
|
||||
GroupedBy eGroupedBy, ScRange* pResultRange);
|
||||
|
||||
void AnovaSingleFactor(AddressWalkerWriter& output, FormulaTemplate& aTemplate);
|
||||
void AnovaTwoFactor(AddressWalkerWriter& output, FormulaTemplate& aTemplate);
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
class ScStatisticsInputOutputDialog : public ScAnyRefDlgController
|
||||
{
|
||||
public:
|
||||
enum GroupedBy {
|
||||
BY_COLUMN,
|
||||
BY_ROW
|
||||
enum class GroupedBy
|
||||
{
|
||||
ByColumn,
|
||||
ByRow
|
||||
};
|
||||
|
||||
ScStatisticsInputOutputDialog(
|
||||
|
||||
Reference in New Issue
Block a user