starmath: SmBinHorNode's symbol is not always an SmMathSymbolNode

E.g. it is an SmGlyphSpecialNode in the "boper" case.

Change-Id: I6311e0dca8e71c617d2c4c681b0b049217ec9867
This commit is contained in:
Takeshi Abe
2016-08-04 18:22:51 +09:00
parent 39e300612c
commit ce97110f37
3 changed files with 14 additions and 14 deletions

View File

@@ -842,8 +842,8 @@ public:
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
void Accept(SmVisitor* pVisitor) override; void Accept(SmVisitor* pVisitor) override;
SmMathSymbolNode* Symbol(); SmNode* Symbol();
const SmMathSymbolNode* Symbol() const; const SmNode* Symbol() const;
SmNode* LeftOperand(); SmNode* LeftOperand();
const SmNode* LeftOperand() const; const SmNode* LeftOperand() const;
SmNode* RightOperand(); SmNode* RightOperand();
@@ -1293,18 +1293,18 @@ inline const SmNode* SmDynIntegralNode::Body() const
} }
inline SmMathSymbolNode* SmBinHorNode::Symbol() inline SmNode* SmBinHorNode::Symbol()
{ {
OSL_ASSERT( GetNumSubNodes() > 1 && GetSubNode( 1 )->GetType() == NMATH ); assert( GetNumSubNodes() == 3 );
return static_cast< SmMathSymbolNode* >( GetSubNode( 1 )); return GetSubNode( 1 );
} }
inline const SmMathSymbolNode* SmBinHorNode::Symbol() const inline const SmNode* SmBinHorNode::Symbol() const
{ {
return const_cast< SmBinHorNode* >( this )->Symbol(); return const_cast< SmBinHorNode* >( this )->Symbol();
} }
inline SmNode* SmBinHorNode::LeftOperand() inline SmNode* SmBinHorNode::LeftOperand()
{ {
OSL_ASSERT( GetNumSubNodes() > 0 ); assert( GetNumSubNodes() == 3 );
return GetSubNode( 0 ); return GetSubNode( 0 );
} }
inline const SmNode* SmBinHorNode::LeftOperand() const inline const SmNode* SmBinHorNode::LeftOperand() const
@@ -1313,7 +1313,7 @@ inline const SmNode* SmBinHorNode::LeftOperand() const
} }
inline SmNode* SmBinHorNode::RightOperand() inline SmNode* SmBinHorNode::RightOperand()
{ {
OSL_ASSERT( GetNumSubNodes() > 2 ); assert( GetNumSubNodes() == 3 );
return GetSubNode( 2 ); return GetSubNode( 2 );
} }
inline const SmNode* SmBinHorNode::RightOperand() const inline const SmNode* SmBinHorNode::RightOperand() const

View File

@@ -824,9 +824,9 @@ void SmDynIntegralNode::CreateTextFromNode(OUString &rText)
void SmBinHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) void SmBinHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
{ {
SmNode *pLeft = GetSubNode(0), SmNode *pLeft = LeftOperand(),
*pOper = GetSubNode(1), *pOper = Symbol(),
*pRight = GetSubNode(2); *pRight = RightOperand();
assert(pLeft); assert(pLeft);
assert(pOper); assert(pOper);
assert(pRight); assert(pRight);

View File

@@ -2185,9 +2185,9 @@ void SmNodeToTextVisitor::Visit( SmUnHorNode* pNode )
void SmNodeToTextVisitor::Visit( SmBinHorNode* pNode ) void SmNodeToTextVisitor::Visit( SmBinHorNode* pNode )
{ {
SmNode *pLeft = pNode->GetSubNode( 0 ), SmNode *pLeft = pNode->LeftOperand(),
*pOper = pNode->GetSubNode( 1 ), *pOper = pNode->Symbol(),
*pRight = pNode->GetSubNode( 2 ); *pRight = pNode->RightOperand();
Separate( ); Separate( );
pLeft->Accept( this ); pLeft->Accept( this );
Separate( ); Separate( );