starmath/inc/node.hxx | 8 +++++--- starmath/source/node.cxx | 12 ++++++------ starmath/source/ooxmlexport.cxx | 4 ++-- starmath/source/visitors.cxx | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-)
New commits: commit 450a8ee1f49ca32184103a7ddc579351cfc24a6d Author: Takeshi Abe <t...@fixedpoint.jp> Date: Mon Aug 8 14:36:15 2016 +0900 starmath: SmBraceNode always has 3 children Change-Id: I53ef8c215866fc45ee82b6805c41c93da0e024b7 Reviewed-on: https://gerrit.libreoffice.org/27980 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index a579221..1e61304 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -1342,7 +1342,8 @@ inline const SmNode* SmAttributNode::Body() const inline SmMathSymbolNode* SmBraceNode::OpeningBrace() { - OSL_ASSERT( GetNumSubNodes() > 0 && GetSubNode( 0 )->GetType() == NMATH ); + assert( GetNumSubNodes() == 3 ); + assert( GetSubNode( 0 )->GetType() == NMATH ); return static_cast< SmMathSymbolNode* >( GetSubNode( 0 )); } inline const SmMathSymbolNode* SmBraceNode::OpeningBrace() const @@ -1351,7 +1352,7 @@ inline const SmMathSymbolNode* SmBraceNode::OpeningBrace() const } inline SmNode* SmBraceNode::Body() { - OSL_ASSERT( GetNumSubNodes() > 1 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 1 ); } inline const SmNode* SmBraceNode::Body() const @@ -1360,7 +1361,8 @@ inline const SmNode* SmBraceNode::Body() const } inline SmMathSymbolNode* SmBraceNode::ClosingBrace() { - OSL_ASSERT( GetNumSubNodes() > 2 && GetSubNode( 2 )->GetType() == NMATH ); + assert( GetNumSubNodes() == 3 ); + assert( GetSubNode( 2 )->GetType() == NMATH ); return static_cast< SmMathSymbolNode* >( GetSubNode( 2 )); } inline const SmMathSymbolNode* SmBraceNode::ClosingBrace() const diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index d5e4a45..511db430 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1350,7 +1350,7 @@ void SmBraceNode::CreateTextFromNode(OUString &rText) rText += "left "; { OUString aStr; - GetSubNode(0)->CreateTextFromNode(aStr); + OpeningBrace()->CreateTextFromNode(aStr); aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); if (!aStr.isEmpty()) @@ -1368,12 +1368,12 @@ void SmBraceNode::CreateTextFromNode(OUString &rText) else rText += "none "; } - GetSubNode(1)->CreateTextFromNode(rText); + Body()->CreateTextFromNode(rText); if (GetScaleMode() == SCALE_HEIGHT) rText += "right "; { OUString aStr; - GetSubNode(2)->CreateTextFromNode(aStr); + ClosingBrace()->CreateTextFromNode(aStr); aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); if (!aStr.isEmpty()) @@ -1397,9 +1397,9 @@ void SmBraceNode::CreateTextFromNode(OUString &rText) void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) { - SmNode *pLeft = GetSubNode(0), - *pBody = GetSubNode(1), - *pRight = GetSubNode(2); + SmNode *pLeft = OpeningBrace(), + *pBody = Body(), + *pRight = ClosingBrace(); assert(pLeft); assert(pBody); assert(pRight); diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index 1e79e68..b387bd6 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -458,7 +458,7 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel ) m_pSerializer->startElementNS( XML_m, XML_dPr, FSEND ); //check if the node has an opening brace - if( TNONE == pNode->GetSubNode(0)->GetToken().eType ) + if( TNONE == pNode->OpeningBrace()->GetToken().eType ) m_pSerializer->singleElementNS( XML_m, XML_begChr, FSNS( XML_m, XML_val ), "", FSEND ); else @@ -490,7 +490,7 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel ) else subnodes.push_back( pNode->Body()); - if( TNONE == pNode->GetSubNode(2)->GetToken().eType ) + if( TNONE == pNode->ClosingBrace()->GetToken().eType ) m_pSerializer->singleElementNS( XML_m, XML_endChr, FSNS( XML_m, XML_val ), "", FSEND ); else diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 7e11f08..e3f9c0b 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -1499,7 +1499,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmBlankNode* pNode ) */ void SmCaretPosGraphBuildingVisitor::Visit( SmBraceNode* pNode ) { - SmNode* pBody = pNode->GetSubNode( 1 ); + SmNode* pBody = pNode->Body(); SmCaretPosGraphEntry *left = mpRightMost, *right = mpGraph->Add( SmCaretPos( pNode, 1 ) ); @@ -1988,9 +1988,9 @@ void SmNodeToTextVisitor::Visit( SmTableNode* pNode ) void SmNodeToTextVisitor::Visit( SmBraceNode* pNode ) { - SmNode *pLeftBrace = pNode->GetSubNode( 0 ), - *pBody = pNode->GetSubNode( 1 ), - *pRightBrace = pNode->GetSubNode( 2 ); + SmNode *pLeftBrace = pNode->OpeningBrace(), + *pBody = pNode->Body(), + *pRightBrace = pNode->ClosingBrace(); //Handle special case where it's absolute function if( pNode->GetToken( ).eType == TABS ) { Append( "abs" );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits