sw/inc/cellfml.hxx | 6 ++--- sw/qa/core/uwriter.cxx | 2 - sw/source/core/fields/cellfml.cxx | 44 +++++++++++++++++++------------------- sw/source/core/fields/tblcalc.cxx | 4 +-- 4 files changed, 28 insertions(+), 28 deletions(-)
New commits: commit ce6815a19fba1639db613a3027b9ba2ca5651b20 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Jan 19 17:25:36 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Jan 20 10:39:51 2026 +0100 sw: Make SwTableFormula::NameType an enum class Change-Id: Ia0e6d995005bfad1c3c05b273860045653069df8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197603 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx index 756e9de571ff..e0f421aa8ef5 100644 --- a/sw/inc/cellfml.hxx +++ b/sw/inc/cellfml.hxx @@ -89,7 +89,7 @@ typedef void (SwTableFormula::*FnScanFormula)( const SwTable&, OUStringBuffer&, static const SwTable* FindTable( SwDoc& rDoc, std::u16string_view rNm ); protected: - enum NameType { EXTRNL_NAME, INTRNL_NAME, REL_NAME }; + enum class NameType { External, Internal, Relative }; OUString m_sFormula; ///< current formula NameType m_eNmType; ///< current display method @@ -128,7 +128,7 @@ public: /// gets called before/after merging/splitting of tables void ToSplitMergeBoxNm( SwTableFormulaUpdate& rTableUpd ); - bool IsIntrnlName() const { return m_eNmType == INTRNL_NAME; } + bool IsIntrnlName() const { return m_eNmType == NameType::Internal; } NameType GetNameType() const { return m_eNmType; } bool IsValid() const { return m_bValidValue; } @@ -138,7 +138,7 @@ public: void SetFormula( const OUString& rNew ) { m_sFormula = rNew; - m_eNmType = EXTRNL_NAME; + m_eNmType = NameType::External; m_bValidValue = false; } diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 0c9fb7fdbd0b..7ea65e298d9d 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1404,7 +1404,7 @@ namespace : SwTableFormula(rStr) , m_pNode(pNode) { - m_eNmType = INTRNL_NAME; + m_eNmType = NameType::Internal; } virtual const SwNode* GetNodeOfFormula() const override { diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 2a82ed5eee69..613e1d2e0f5d 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -323,7 +323,7 @@ bool SwTableCalcPara::CalcWithStackOverflow() SwTableFormula::SwTableFormula( OUString aFormula ) : m_sFormula( std::move(aFormula) ) -, m_eNmType( EXTRNL_NAME ) +, m_eNmType( NameType::External ) , m_bValidValue( false ) { } @@ -511,13 +511,13 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, OUStringBuffer& rNewS if( pLastBox ) { rNewStr.append(lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, *pLastBox, - m_eNmType == EXTRNL_NAME )); + m_eNmType == NameType::External )); rNewStr.append(":"); rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 ); } rNewStr.append(lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, rFirstBox, - m_eNmType == EXTRNL_NAME )); + m_eNmType == NameType::External )); // get label for the box rNewStr.append(rFirstBox[ rFirstBox.getLength()-1 ]); @@ -583,23 +583,23 @@ void SwTableFormula::PtrToBoxNm( const SwTable* pTable ) FnScanFormula fnFormula = nullptr; switch (m_eNmType) { - case INTRNL_NAME: + case NameType::Internal: if( pTable ) fnFormula = &SwTableFormula::PtrToBoxNms; break; - case REL_NAME: + case NameType::Relative: if( pTable ) { fnFormula = &SwTableFormula::RelNmsToBoxNms; pNd = GetNodeOfFormula(); } break; - case EXTRNL_NAME: + case NameType::External: return; } assert(pTable); m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); - m_eNmType = EXTRNL_NAME; + m_eNmType = NameType::External; } /// create internal formula (in CORE) @@ -609,23 +609,23 @@ void SwTableFormula::BoxNmToPtr( const SwTable* pTable ) FnScanFormula fnFormula = nullptr; switch (m_eNmType) { - case EXTRNL_NAME: + case NameType::External: if( pTable ) fnFormula = &SwTableFormula::BoxNmsToPtr; break; - case REL_NAME: + case NameType::Relative: if( pTable ) { fnFormula = &SwTableFormula::RelBoxNmsToPtr; pNd = GetNodeOfFormula(); } break; - case INTRNL_NAME: + case NameType::Internal: return; } assert(pTable); m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); - m_eNmType = INTRNL_NAME; + m_eNmType = NameType::Internal; } /// create relative formula (for copy) @@ -635,20 +635,20 @@ void SwTableFormula::ToRelBoxNm( const SwTable* pTable ) FnScanFormula fnFormula = nullptr; switch (m_eNmType) { - case INTRNL_NAME: - case EXTRNL_NAME: + case NameType::Internal: + case NameType::External: if( pTable ) { fnFormula = &SwTableFormula::BoxNmsToRelNm; pNd = GetNodeOfFormula(); } break; - case REL_NAME: + case NameType::Relative: return; } assert(pTable); m_sFormula = ScanString( fnFormula, *pTable, const_cast<void*>(static_cast<void const *>(pNd)) ); - m_eNmType = REL_NAME; + m_eNmType = NameType::Relative; } OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTable, @@ -1040,13 +1040,13 @@ void SwTableFormula::HasValidBoxes_( const SwTable& rTable, OUStringBuffer& , switch (m_eNmType) { - case INTRNL_NAME: + case NameType::Internal: if( pLastBox ) pEndBox = reinterpret_cast<SwTableBox*>(sal::static_int_cast<sal_IntPtr>(pLastBox->toInt64())); pSttBox = reinterpret_cast<SwTableBox*>(sal::static_int_cast<sal_IntPtr>(rFirstBox.toInt64())); break; - case REL_NAME: + case NameType::Relative: { const SwNode* pNd = GetNodeOfFormula(); const SwTableBox* pBox = !pNd ? nullptr @@ -1058,7 +1058,7 @@ void SwTableFormula::HasValidBoxes_( const SwTable& rTable, OUStringBuffer& , } break; - case EXTRNL_NAME: + case NameType::External: if( pLastBox ) pEndBox = const_cast<SwTableBox*>(rTable.GetTableBox( *pLastBox )); pSttBox = const_cast<SwTableBox*>(rTable.GetTableBox( rFirstBox )); @@ -1154,13 +1154,13 @@ void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUStringBuffer& rN SwTableBox* pSttBox = nullptr, *pEndBox = nullptr; switch (m_eNmType) { - case INTRNL_NAME: + case NameType::Internal: if( pLastBox ) pEndBox = reinterpret_cast<SwTableBox*>(sal::static_int_cast<sal_IntPtr>(pLastBox->toInt64())); pSttBox = reinterpret_cast<SwTableBox*>(sal::static_int_cast<sal_IntPtr>(rFirstBox.toInt64())); break; - case REL_NAME: + case NameType::Relative: { const SwNode* pNd = GetNodeOfFormula(); const SwTableBox* pBox = pNd ? pTable->GetTableBox( @@ -1171,7 +1171,7 @@ void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUStringBuffer& rN } break; - case EXTRNL_NAME: + case NameType::External: if( pLastBox ) pEndBox = const_cast<SwTableBox*>(pTable->GetTableBox( *pLastBox )); pSttBox = const_cast<SwTableBox*>(pTable->GetTableBox( rFirstBox )); @@ -1259,7 +1259,7 @@ void SwTableFormula::ToSplitMergeBoxNm( SwTableFormulaUpdate& rTableUpd ) pTable = rTableUpd.m_pTable; m_sFormula = ScanString( &SwTableFormula::SplitMergeBoxNm_, *pTable, static_cast<void*>(&rTableUpd) ); - m_eNmType = INTRNL_NAME; + m_eNmType = NameType::Internal; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 6b93483d943b..3bfc0d436771 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -85,7 +85,7 @@ const SwNode* SwTableField::GetNodeOfFormula() const OUString SwTableField::GetCommand() { - if (EXTRNL_NAME != GetNameType()) + if (NameType::External != GetNameType()) { SwNode const*const pNd = GetNodeOfFormula(); SwTableNode const*const pTableNd = pNd ? pNd->FindTableNode() : nullptr; @@ -94,7 +94,7 @@ OUString SwTableField::GetCommand() PtrToBoxNm( &pTableNd->GetTable() ); } } - return (EXTRNL_NAME == GetNameType()) + return (NameType::External == GetNameType()) ? SwTableFormula::GetFormula() : OUString(); }
