reportdesign/inc/reportformula.hxx | 6 ++--- reportdesign/source/core/misc/conditionupdater.cxx | 2 - reportdesign/source/core/misc/reportformula.cxx | 14 ++++++------- reportdesign/source/ui/dlg/Condition.cxx | 6 ++--- reportdesign/source/ui/inspection/GeometryHandler.cxx | 2 - reportdesign/source/ui/report/FormattedFieldBeautifier.cxx | 2 - reportdesign/source/ui/report/ReportController.cxx | 4 +-- 7 files changed, 18 insertions(+), 18 deletions(-)
New commits: commit fda12db13c9d570f4f19edbda764715932437a65 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Oct 2 18:33:04 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Oct 2 21:46:02 2025 +0200 reportdesign: Make ReportFormula::BindType an enum class Change-Id: I9b5d444661c69a46e2a6e6353d79a29e68863c93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191795 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/reportdesign/inc/reportformula.hxx b/reportdesign/inc/reportformula.hxx index afb123b297c6..6075c460f398 100644 --- a/reportdesign/inc/reportformula.hxx +++ b/reportdesign/inc/reportformula.hxx @@ -36,7 +36,7 @@ namespace rptui class UNLESS_MERGELIBS_MORE(REPORTDESIGN_DLLPUBLIC) ReportFormula { public: - enum BindType + enum class BindType { Expression, Field, @@ -100,14 +100,14 @@ namespace rptui inline OUString const & ReportFormula::getFieldName() const { - OSL_PRECOND( getType() == Field, "ReportFormula::getFieldName: not bound to a field!" ); + OSL_PRECOND(getType() == BindType::Field, "ReportFormula::getFieldName: not bound to a field!"); return getUndecoratedContent(); } inline OUString const & ReportFormula::getExpression() const { - OSL_PRECOND( getType() == Expression, "ReportFormula::getExpression: not bound to an expression!" ); + OSL_PRECOND( getType() == BindType::Expression, "ReportFormula::getExpression: not bound to an expression!" ); return getUndecoratedContent(); } diff --git a/reportdesign/source/core/misc/conditionupdater.cxx b/reportdesign/source/core/misc/conditionupdater.cxx index 7bd32c6b3d57..4e568b09d8d4 100644 --- a/reportdesign/source/core/misc/conditionupdater.cxx +++ b/reportdesign/source/core/misc/conditionupdater.cxx @@ -99,7 +99,7 @@ namespace rptui // the expression matches -> translate it to the new data source of the report control model sFormulaExpression = rEntry.second->assembleExpression( sNewUnprefixed, sLHS, sRHS ); - ReportFormula aFormula(ReportFormula(ReportFormula::Expression, sFormulaExpression)); + ReportFormula aFormula(ReportFormula(ReportFormula::BindType::Expression, sFormulaExpression)); xFormatCondition->setFormula(aFormula.getCompleteFormula()); break; } diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx index 6b2d528ee9ee..21e01a289908 100644 --- a/reportdesign/source/core/misc/reportformula.cxx +++ b/reportdesign/source/core/misc/reportformula.cxx @@ -36,14 +36,14 @@ namespace rptui ReportFormula::ReportFormula( const OUString& _rFormula ) - :m_eType( Invalid ) + :m_eType(BindType::Invalid) { m_sCompleteFormula = _rFormula; // is it an ordinary expression? if ( m_sCompleteFormula.startsWith( sExpressionPrefix, &m_sUndecoratedContent ) ) { - m_eType = Expression; + m_eType = BindType::Expression; return; } @@ -56,7 +56,7 @@ namespace rptui && ( m_sCompleteFormula[ m_sCompleteFormula.getLength() - 1 ] == ']' ) ) { - m_eType = Field; + m_eType = BindType::Field; m_sUndecoratedContent = m_sCompleteFormula.copy( nPrefixLen + 1, m_sCompleteFormula.getLength() - nPrefixLen - 2 ); return; } @@ -69,7 +69,7 @@ namespace rptui { switch ( m_eType ) { - case Expression: + case BindType::Expression: { if ( _rFieldOrExpression.startsWith( sExpressionPrefix ) ) m_sCompleteFormula = _rFieldOrExpression; @@ -78,7 +78,7 @@ namespace rptui } break; - case Field: + case BindType::Field: { m_sCompleteFormula = sFieldPrefix + OUString::Concat(u"[") + _rFieldOrExpression + "]"; } @@ -97,7 +97,7 @@ namespace rptui OUString ReportFormula::getBracketedFieldOrExpression() const { - bool bIsField = ( getType() == Field ); + bool bIsField = ( getType() == BindType::Field ); OUStringBuffer aFieldContent; if ( bIsField ) aFieldContent.append( "[" ); @@ -108,7 +108,7 @@ namespace rptui return aFieldContent.makeStringAndClear(); } - bool ReportFormula::isValid() const { return getType() != Invalid; } + bool ReportFormula::isValid() const { return getType() != BindType::Invalid; } OUString ReportFormula::getEqualUndecoratedContent() const { diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 7a5e1e2fd006..933272ce9bd3 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -245,9 +245,9 @@ void Condition::impl_setCondition( const OUString& _rConditionFormula ) { // the unprefixed expression which forms the condition ReportFormula aFormula( _rConditionFormula ); - OSL_ENSURE( aFormula.getType() == ReportFormula::Expression, "Condition::setCondition: illegal formula!" ); + OSL_ENSURE( aFormula.getType() == ReportFormula::BindType::Expression, "Condition::setCondition: illegal formula!" ); OUString sExpression; - if ( aFormula.getType() == ReportFormula::Expression ) + if (aFormula.getType() == ReportFormula::BindType::Expression) sExpression = aFormula.getExpression(); // as fallback, if the below matching does not succeed, assume // the whole expression is the LHS @@ -352,7 +352,7 @@ void Condition::fillFormatCondition(const uno::Reference< report::XFormatConditi sUndecoratedFormula = pFactory->assembleExpression( sUnprefixedFieldContent, sLHS, sRHS ); } - ReportFormula aFormula( ReportFormula::Expression, sUndecoratedFormula ); + ReportFormula aFormula(ReportFormula::BindType::Expression, sUndecoratedFormula); _xCondition->setFormula( aFormula.getCompleteFormula() ); } diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 9f56510451ea..85bff9cdebc3 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -191,7 +191,7 @@ OUString GeometryHandler::impl_convertToFormula( const uno::Any& _rControlValue if ( aParser.isValid() ) return sName; - return ReportFormula(impl_isDataField(sName) ? ReportFormula::Field : ReportFormula::Expression, sName).getCompleteFormula(); + return ReportFormula(impl_isDataField(sName) ? ReportFormula::BindType::Field : ReportFormula::BindType::Expression, sName).getCompleteFormula(); } GeometryHandler::GeometryHandler(uno::Reference< uno::XComponentContext > const & context) diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx index 62588524e3d4..c2f991b97af2 100644 --- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -77,7 +77,7 @@ namespace rptui { ReportFormula aFormula( sDataField ); bool bSet = true; - if ( aFormula.getType() == ReportFormula::Field ) + if ( aFormula.getType() == ReportFormula::BindType::Field ) { const OUString& sColumnName = aFormula.getFieldName(); OUString sLabel = m_rReportController.getColumnLabel_throw(sColumnName); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 2172790bf587..c92a41706d8a 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3180,7 +3180,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() ) { - ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction ); + ReportFormula aFunctionFormula(ReportFormula::BindType::Expression, _sFunction ); xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFunctionFormula.getCompleteFormula() ) ); } @@ -3493,7 +3493,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) sDefaultName = sName; xUnoProp->setPropertyValue(PROPERTY_NAME,uno::Any(sDefaultName)); - ReportFormula aFormula( ReportFormula::Field, sName ); + ReportFormula aFormula( ReportFormula::BindType::Field, sName ); xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFormula.getCompleteFormula() ) ); }