summaryrefslogtreecommitdiff
path: root/sc/source/ui/StatisticsDialogs
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-03-09 15:23:11 +0100
committerEike Rathke <erack@redhat.com>2016-03-12 00:21:29 +0000
commit51d0b4037b36a4a74c9181b95edb18017542ab79 (patch)
treec13c5ac4782888e1640ee60911d68329018dcc05 /sc/source/ui/StatisticsDialogs
parentdc519b6dea7653e4b68b45aa664e3c0b5189d682 (diff)
tdf#84938 Change defines to typed_flags
Put defines into an enum class and use typed_flags template from o3tl to give them flag operators. There were some shift operations to apply flags from start references to end references, these went into a helper in address.hxx to hide them. A marco with shift operations in address.cxx was rewritten in two helpers without shifts. One shift remained in ScRange::Format with a comment. The other flag untypical operator was a minus 1 in a helper for ScRefFinder::ToggleRel, which iteratates through all possible combinations for absolute references. This is used to make referecnces absolute via SHIFT+F4. A replacement would be too complex. Change-Id: I4850f1623e01e56c60ac2260b95fc5cad8b6fd71 Signed-off-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-on: https://gerrit.libreoffice.org/22840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/StatisticsDialogs')
-rw-r--r--sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx4
-rw-r--r--sc/source/ui/StatisticsDialogs/SamplingDialog.cxx12
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx12
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx18
-rw-r--r--sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx6
6 files changed, 33 insertions, 21 deletions
diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index e6329bc5d5bc..84ed14c80f64 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -68,7 +68,7 @@ OUString lclCreateMultiParameterFormula(
OUString aResult;
for (size_t i = 0; i < aRangeList.size(); i++)
{
- OUString aRangeString(aRangeList[i]->Format(SCR_ABS, pDocument, aAddressDetails));
+ OUString aRangeString(aRangeList[i]->Format(ScRefFlags::RANGE_ABS, pDocument, aAddressDetails));
OUString aFormulaString = aFormulaTemplate.replaceAll(aWildcard, aRangeString);
aResult += aFormulaString;
if(i != aRangeList.size() - 1) // Not Last
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 83b1cedf035f..e1e07f456697 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -136,7 +136,7 @@ void ScRandomNumberGeneratorDialog::Init()
void ScRandomNumberGeneratorDialog::GetRangeFromSelection()
{
mpViewData->GetSimpleArea(maInputRange);
- OUString aCurrentString(maInputRange.Format(SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
+ OUString aCurrentString(maInputRange.Format(ScRefFlags::RANGE_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
mpInputRangeEdit->SetText( aCurrentString );
}
@@ -169,7 +169,7 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange
maInputRange = rReferenceRange;
- OUString aReferenceString(maInputRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aReferenceString(maInputRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
mpInputRangeEdit->SetRefString( aReferenceString );
mpButtonApply->Enable();
diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 4a03c7ec1775..6f9b95a47618 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -122,7 +122,7 @@ void ScSamplingDialog::Init()
void ScSamplingDialog::GetRangeFromSelection()
{
mViewData->GetSimpleArea(mInputRange);
- OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails));
+ OUString aCurrentString(mInputRange.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails));
mpInputRangeEdit->SetText(aCurrentString);
}
@@ -158,14 +158,16 @@ void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument*
if ( mpActiveEdit == mpInputRangeEdit )
{
mInputRange = rReferenceRange;
- aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mInputRange.Format(ScRefFlags::RANGE_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;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
@@ -370,7 +372,9 @@ IMPL_LINK_NOARG_TYPED(ScSamplingDialog, RefInputModifyHandler, Edit&, void)
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
index 02a3e717be86..0ca3a93e242d 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
@@ -141,7 +141,7 @@ void ScStatisticsInputOutputDialog::Init()
void ScStatisticsInputOutputDialog::GetRangeFromSelection()
{
mViewData->GetSimpleArea(mInputRange);
- OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails));
+ OUString aCurrentString(mInputRange.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails));
mpInputRangeEdit->SetText(aCurrentString);
}
@@ -172,14 +172,16 @@ void ScStatisticsInputOutputDialog::SetReference( const ScRange& rReferenceRange
if ( mpActiveEdit == mpInputRangeEdit )
{
mInputRange = rReferenceRange;
- aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mInputRange.Format(ScRefFlags::RANGE_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;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
@@ -256,7 +258,9 @@ IMPL_LINK_NOARG_TYPED( ScStatisticsInputOutputDialog, RefInputModifyHandler, Edi
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
index df6dc0117615..3d99a1f7ef0d 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
@@ -136,18 +136,18 @@ void ScStatisticsTwoVariableDialog::GetRangeFromSelection()
{
mVariable1Range = aCurrentRange;
mVariable1Range.aEnd.SetCol(mVariable1Range.aStart.Col());
- aCurrentString = mVariable1Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable1RangeEdit->SetText(aCurrentString);
mVariable2Range = aCurrentRange;
mVariable2Range.aStart.SetCol(mVariable2Range.aEnd.Col());
- aCurrentString = mVariable2Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable2RangeEdit->SetText(aCurrentString);
}
else
{
mVariable1Range = aCurrentRange;
- aCurrentString = mVariable1Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable1RangeEdit->SetText(aCurrentString);
}
}
@@ -179,20 +179,22 @@ void ScStatisticsTwoVariableDialog::SetReference( const ScRange& rReferenceRange
if ( mpActiveEdit == mpVariable1RangeEdit )
{
mVariable1Range = rReferenceRange;
- aReferenceString = mVariable1Range.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpVariable1RangeEdit->SetRefString(aReferenceString);
}
else if ( mpActiveEdit == mpVariable2RangeEdit )
{
mVariable2Range = rReferenceRange;
- aReferenceString = mVariable2Range.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpVariable2RangeEdit->SetRefString(aReferenceString);
}
else if ( mpActiveEdit == mpOutputRangeEdit )
{
mOutputAddress = rReferenceRange.aStart;
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
@@ -295,7 +297,9 @@ IMPL_LINK_NOARG_TYPED( ScStatisticsTwoVariableDialog, RefInputModifyHandler, Edi
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index 982249c3553a..96c004061ee9 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -61,7 +61,7 @@ void FormulaTemplate::autoReplaceAddress(const OUString& aVariable, ScAddress aA
void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D)
{
- sal_uInt16 nFlag = b3D ? SCR_ABS_3D : SCR_ABS;
+ ScRefFlags nFlag = b3D ? ScRefFlags::RANGE_ABS_3D : ScRefFlags::RANGE_ABS;
OUString aString = aRange.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}
@@ -69,13 +69,13 @@ void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRang
void FormulaTemplate::applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList)
{
OUString aString;
- aRangeList.Format(aString, SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
+ aRangeList.Format(aString, ScRefFlags::RANGE_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}
void FormulaTemplate::applyAddress(const OUString& aVariable, const ScAddress& aAddress, bool b3D)
{
- sal_uInt16 nFlag = b3D ? SCA_ABS_3D : SCA_ABS;
+ ScRefFlags nFlag = b3D ? ScRefFlags::ADDR_ABS_3D : ScRefFlags::ADDR_ABS;
OUString aString = aAddress.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}