starmath/inc/node.hxx | 7 ++++--- starmath/source/mathmlexport.cxx | 11 +++++------ starmath/source/mathmlexport.hxx | 2 +- starmath/source/node.cxx | 6 +++--- starmath/source/visitors.cxx | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-)
New commits: commit 389b08190092f9a9103b3ac098994ec83b2d0bfa Author: Takeshi Abe <[email protected]> Date: Mon Aug 1 18:14:21 2016 +0900 starmath: SmVerticalBraceNode always has a triple of nodes Moreover the middle ("Brace") node is a SmMathSymbolNode. Change-Id: Ia0e4f798b69a9a205269bbd3f6c63d2059e8c766 Reviewed-on: https://gerrit.libreoffice.org/27769 Tested-by: Jenkins <[email protected]> Reviewed-by: Takeshi Abe <[email protected]> diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 3511d71..a2b50d7 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -1369,7 +1369,7 @@ inline const SmMathSymbolNode* SmBraceNode::ClosingBrace() const inline SmNode* SmVerticalBraceNode::Body() { - OSL_ASSERT( GetNumSubNodes() > 0 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 0 ); } inline const SmNode* SmVerticalBraceNode::Body() const @@ -1378,7 +1378,8 @@ inline const SmNode* SmVerticalBraceNode::Body() const } inline SmMathSymbolNode* SmVerticalBraceNode::Brace() { - OSL_ASSERT( GetNumSubNodes() > 1 && GetSubNode( 1 )->GetType() == NMATH ); + assert( GetNumSubNodes() == 3 ); + assert( GetSubNode( 1 )->GetType() == NMATH ); return static_cast< SmMathSymbolNode* >( GetSubNode( 1 )); } inline const SmMathSymbolNode* SmVerticalBraceNode::Brace() const @@ -1387,7 +1388,7 @@ inline const SmMathSymbolNode* SmVerticalBraceNode::Brace() const } inline SmNode* SmVerticalBraceNode::Script() { - OSL_ASSERT( GetNumSubNodes() > 2 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 2 ); } inline const SmNode* SmVerticalBraceNode::Script() const diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index cb1ed0e..6abd5be 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1391,7 +1391,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) } -void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel) +void SmXMLExport::ExportVerticalBrace(const SmVerticalBraceNode *pNode, int nLevel) { // "[body] overbrace [script]" @@ -1417,18 +1417,17 @@ void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel) break; } - OSL_ENSURE(pNode->GetNumSubNodes()==3,"Bad Vertical Brace"); SvXMLElementExport aOver1(*this, XML_NAMESPACE_MATH,which, true, true); {//Scoping // using accents will draw the over-/underbraces too close to the base // see http://www.w3.org/TR/MathML2/chapter3.html#id.3.4.5.2 // also XML_ACCENT is illegal with XML_MUNDER. Thus no XML_ACCENT attribute here! SvXMLElementExport aOver2(*this, XML_NAMESPACE_MATH,which, true, true); - ExportNodes(pNode->GetSubNode(0), nLevel); + ExportNodes(pNode->Body(), nLevel); AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE); - ExportNodes(pNode->GetSubNode(1), nLevel); + ExportNodes(pNode->Brace(), nLevel); } - ExportNodes(pNode->GetSubNode(2), nLevel); + ExportNodes(pNode->Script(), nLevel); } void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel) @@ -1554,7 +1553,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) ExportFont(pNode, nLevel); break; case NVERTICAL_BRACE: - ExportVerticalBrace(pNode, nLevel); + ExportVerticalBrace(static_cast<const SmVerticalBraceNode *>(pNode), nLevel); break; case NMATRIX: ExportMatrix(pNode, nLevel); diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx index 791efa6..2d18648 100644 --- a/starmath/source/mathmlexport.hxx +++ b/starmath/source/mathmlexport.hxx @@ -89,7 +89,7 @@ protected: void ExportOperator(const SmNode *pNode, int nLevel); void ExportAttributes(const SmNode *pNode, int nLevel); void ExportFont(const SmNode *pNode, int nLevel); - void ExportVerticalBrace(const SmNode *pNode, int nLevel); + void ExportVerticalBrace(const SmVerticalBraceNode *pNode, int nLevel); void ExportMatrix(const SmNode *pNode, int nLevel); void ExportBlank(const SmNode *pNode, int nLevel); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 34c3480..e6a4726 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1555,9 +1555,9 @@ void SmBracebodyNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) void SmVerticalBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) { - SmNode *pBody = GetSubNode(0), - *pBrace = GetSubNode(1), - *pScript = GetSubNode(2); + SmNode *pBody = Body(), + *pBrace = Brace(), + *pScript = Script(); assert(pBody); assert(pBrace); assert(pScript); diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 7efec06..87d177b 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -1181,8 +1181,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmBinVerNode* pNode ) */ void SmCaretPosGraphBuildingVisitor::Visit( SmVerticalBraceNode* pNode ) { - SmNode *pBody = pNode->GetSubNode( 0 ), - *pScript = pNode->GetSubNode( 2 ); + SmNode *pBody = pNode->Body(), + *pScript = pNode->Script(); //None of these children can be NULL SmCaretPosGraphEntry *left, @@ -2396,8 +2396,8 @@ void SmNodeToTextVisitor::Visit( SmRectangleNode* ) void SmNodeToTextVisitor::Visit( SmVerticalBraceNode* pNode ) { - SmNode *pBody = pNode->GetSubNode( 0 ), - *pScript = pNode->GetSubNode( 2 ); + SmNode *pBody = pNode->Body(), + *pScript = pNode->Script(); LineToText( pBody ); Append( pNode->GetToken( ).aText ); LineToText( pScript ); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
