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 <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
This commit is contained in:
@@ -1369,7 +1369,7 @@ inline const SmMathSymbolNode* SmBraceNode::ClosingBrace() const
|
|||||||
|
|
||||||
inline SmNode* SmVerticalBraceNode::Body()
|
inline SmNode* SmVerticalBraceNode::Body()
|
||||||
{
|
{
|
||||||
OSL_ASSERT( GetNumSubNodes() > 0 );
|
assert( GetNumSubNodes() == 3 );
|
||||||
return GetSubNode( 0 );
|
return GetSubNode( 0 );
|
||||||
}
|
}
|
||||||
inline const SmNode* SmVerticalBraceNode::Body() const
|
inline const SmNode* SmVerticalBraceNode::Body() const
|
||||||
@@ -1378,7 +1378,8 @@ inline const SmNode* SmVerticalBraceNode::Body() const
|
|||||||
}
|
}
|
||||||
inline SmMathSymbolNode* SmVerticalBraceNode::Brace()
|
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 ));
|
return static_cast< SmMathSymbolNode* >( GetSubNode( 1 ));
|
||||||
}
|
}
|
||||||
inline const SmMathSymbolNode* SmVerticalBraceNode::Brace() const
|
inline const SmMathSymbolNode* SmVerticalBraceNode::Brace() const
|
||||||
@@ -1387,7 +1388,7 @@ inline const SmMathSymbolNode* SmVerticalBraceNode::Brace() const
|
|||||||
}
|
}
|
||||||
inline SmNode* SmVerticalBraceNode::Script()
|
inline SmNode* SmVerticalBraceNode::Script()
|
||||||
{
|
{
|
||||||
OSL_ASSERT( GetNumSubNodes() > 2 );
|
assert( GetNumSubNodes() == 3 );
|
||||||
return GetSubNode( 2 );
|
return GetSubNode( 2 );
|
||||||
}
|
}
|
||||||
inline const SmNode* SmVerticalBraceNode::Script() const
|
inline const SmNode* SmVerticalBraceNode::Script() const
|
||||||
|
@@ -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]"
|
// "[body] overbrace [script]"
|
||||||
|
|
||||||
@@ -1417,18 +1417,17 @@ void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSL_ENSURE(pNode->GetNumSubNodes()==3,"Bad Vertical Brace");
|
|
||||||
SvXMLElementExport aOver1(*this, XML_NAMESPACE_MATH,which, true, true);
|
SvXMLElementExport aOver1(*this, XML_NAMESPACE_MATH,which, true, true);
|
||||||
{//Scoping
|
{//Scoping
|
||||||
// using accents will draw the over-/underbraces too close to the base
|
// 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
|
// 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!
|
// also XML_ACCENT is illegal with XML_MUNDER. Thus no XML_ACCENT attribute here!
|
||||||
SvXMLElementExport aOver2(*this, XML_NAMESPACE_MATH,which, true, true);
|
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);
|
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)
|
void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel)
|
||||||
@@ -1554,7 +1553,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel)
|
|||||||
ExportFont(pNode, nLevel);
|
ExportFont(pNode, nLevel);
|
||||||
break;
|
break;
|
||||||
case NVERTICAL_BRACE:
|
case NVERTICAL_BRACE:
|
||||||
ExportVerticalBrace(pNode, nLevel);
|
ExportVerticalBrace(static_cast<const SmVerticalBraceNode *>(pNode), nLevel);
|
||||||
break;
|
break;
|
||||||
case NMATRIX:
|
case NMATRIX:
|
||||||
ExportMatrix(pNode, nLevel);
|
ExportMatrix(pNode, nLevel);
|
||||||
|
@@ -89,7 +89,7 @@ protected:
|
|||||||
void ExportOperator(const SmNode *pNode, int nLevel);
|
void ExportOperator(const SmNode *pNode, int nLevel);
|
||||||
void ExportAttributes(const SmNode *pNode, int nLevel);
|
void ExportAttributes(const SmNode *pNode, int nLevel);
|
||||||
void ExportFont(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 ExportMatrix(const SmNode *pNode, int nLevel);
|
||||||
void ExportBlank(const SmNode *pNode, int nLevel);
|
void ExportBlank(const SmNode *pNode, int nLevel);
|
||||||
|
|
||||||
|
@@ -1555,9 +1555,9 @@ void SmBracebodyNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
|
|||||||
|
|
||||||
void SmVerticalBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
|
void SmVerticalBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
|
||||||
{
|
{
|
||||||
SmNode *pBody = GetSubNode(0),
|
SmNode *pBody = Body(),
|
||||||
*pBrace = GetSubNode(1),
|
*pBrace = Brace(),
|
||||||
*pScript = GetSubNode(2);
|
*pScript = Script();
|
||||||
assert(pBody);
|
assert(pBody);
|
||||||
assert(pBrace);
|
assert(pBrace);
|
||||||
assert(pScript);
|
assert(pScript);
|
||||||
|
@@ -1181,8 +1181,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmBinVerNode* pNode )
|
|||||||
*/
|
*/
|
||||||
void SmCaretPosGraphBuildingVisitor::Visit( SmVerticalBraceNode* pNode )
|
void SmCaretPosGraphBuildingVisitor::Visit( SmVerticalBraceNode* pNode )
|
||||||
{
|
{
|
||||||
SmNode *pBody = pNode->GetSubNode( 0 ),
|
SmNode *pBody = pNode->Body(),
|
||||||
*pScript = pNode->GetSubNode( 2 );
|
*pScript = pNode->Script();
|
||||||
//None of these children can be NULL
|
//None of these children can be NULL
|
||||||
|
|
||||||
SmCaretPosGraphEntry *left,
|
SmCaretPosGraphEntry *left,
|
||||||
@@ -2396,8 +2396,8 @@ void SmNodeToTextVisitor::Visit( SmRectangleNode* )
|
|||||||
|
|
||||||
void SmNodeToTextVisitor::Visit( SmVerticalBraceNode* pNode )
|
void SmNodeToTextVisitor::Visit( SmVerticalBraceNode* pNode )
|
||||||
{
|
{
|
||||||
SmNode *pBody = pNode->GetSubNode( 0 ),
|
SmNode *pBody = pNode->Body(),
|
||||||
*pScript = pNode->GetSubNode( 2 );
|
*pScript = pNode->Script();
|
||||||
LineToText( pBody );
|
LineToText( pBody );
|
||||||
Append( pNode->GetToken( ).aText );
|
Append( pNode->GetToken( ).aText );
|
||||||
LineToText( pScript );
|
LineToText( pScript );
|
||||||
|
Reference in New Issue
Block a user