diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2023-06-03 21:58:59 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2023-06-04 07:48:17 +0200 |
commit | befc6ac8e20863c913da0fd0bac2fa26bab1b025 (patch) | |
tree | afa281f63ba7191511904b4118111182823c1130 | |
parent | 7b84152bdc580bd7277b96a9bacf63c51e0afa0c (diff) |
Related tdf#155630: deduplicate in starmath/visitors
Change-Id: I331ce6d2e24e395a1c85789cdc4bd1f973287027
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152580
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | starmath/source/visitors.cxx | 75 |
1 files changed, 12 insertions, 63 deletions
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 42257925d38e..92c1ef3413ec 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -871,71 +871,20 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode ) bodyRight->SetRight( right ); right->SetLeft( bodyRight ); - //If there's an LSUP - SmNode* pChild = pNode->GetSubSup( LSUP ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left ); - - mpRightMost = cLeft; - pChild->Accept( this ); - - mpRightMost->SetRight( bodyLeft ); - } - //If there's an LSUB - pChild = pNode->GetSubSup( LSUB ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left ); - - mpRightMost = cLeft; - pChild->Accept( this ); - - mpRightMost->SetRight( bodyLeft ); - } - //If there's a CSUP - pChild = pNode->GetSubSup( CSUP ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left ); - - mpRightMost = cLeft; - pChild->Accept( this ); - - mpRightMost->SetRight( right ); - } - //If there's a CSUB - pChild = pNode->GetSubSup( CSUB ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left ); - - mpRightMost = cLeft; - pChild->Accept( this ); - - mpRightMost->SetRight( right ); - } - //If there's an RSUP - pChild = pNode->GetSubSup( RSUP ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), bodyRight ); - - mpRightMost = cLeft; - pChild->Accept( this ); - - mpRightMost->SetRight( right ); - } - //If there's an RSUB - pChild = pNode->GetSubSup( RSUB ); - if( pChild ){ - SmCaretPosGraphEntry *cLeft; //Child left - cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), bodyRight ); + SmNode* pChild; + for (SmSubSup const nodeType : { LSUP, LSUB, CSUP, CSUB, RSUP, RSUB }) + { + pChild = pNode->GetSubSup(nodeType); + if( pChild ) + { + SmCaretPosGraphEntry *cLeft; //Child left + cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), ((nodeType == RSUP) || (nodeType == RSUB))?bodyRight:left ); - mpRightMost = cLeft; - pChild->Accept( this ); + mpRightMost = cLeft; + pChild->Accept( this ); - mpRightMost->SetRight( right ); + mpRightMost->SetRight( ((nodeType == LSUP) || (nodeType == LSUB))?bodyLeft:right ); + } } //Set return parameters |