diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-08-04 18:22:51 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2016-08-05 13:36:45 +0900 |
commit | ce97110f37825f9666bff8ff2df0d2092620ae17 (patch) | |
tree | e76271f546a5b798026e1bb266b21b48707d09ea /starmath | |
parent | 39e300612c97b7742c8d8417d4dc6c0022cfa040 (diff) |
starmath: SmBinHorNode's symbol is not always an SmMathSymbolNode
E.g. it is an SmGlyphSpecialNode in the "boper" case.
Change-Id: I6311e0dca8e71c617d2c4c681b0b049217ec9867
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 16 | ||||
-rw-r--r-- | starmath/source/node.cxx | 6 | ||||
-rw-r--r-- | starmath/source/visitors.cxx | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index c22e9a79deec..e0b2019d433a 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -842,8 +842,8 @@ public: virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; void Accept(SmVisitor* pVisitor) override; - SmMathSymbolNode* Symbol(); - const SmMathSymbolNode* Symbol() const; + SmNode* Symbol(); + const SmNode* Symbol() const; SmNode* LeftOperand(); const SmNode* LeftOperand() const; 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 ); - return static_cast< SmMathSymbolNode* >( GetSubNode( 1 )); + assert( GetNumSubNodes() == 3 ); + return GetSubNode( 1 ); } -inline const SmMathSymbolNode* SmBinHorNode::Symbol() const +inline const SmNode* SmBinHorNode::Symbol() const { return const_cast< SmBinHorNode* >( this )->Symbol(); } inline SmNode* SmBinHorNode::LeftOperand() { - OSL_ASSERT( GetNumSubNodes() > 0 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 0 ); } inline const SmNode* SmBinHorNode::LeftOperand() const @@ -1313,7 +1313,7 @@ inline const SmNode* SmBinHorNode::LeftOperand() const } inline SmNode* SmBinHorNode::RightOperand() { - OSL_ASSERT( GetNumSubNodes() > 2 ); + assert( GetNumSubNodes() == 3 ); return GetSubNode( 2 ); } inline const SmNode* SmBinHorNode::RightOperand() const diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index c1d53f1975cf..5b45745a0474 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -824,9 +824,9 @@ void SmDynIntegralNode::CreateTextFromNode(OUString &rText) void SmBinHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) { - SmNode *pLeft = GetSubNode(0), - *pOper = GetSubNode(1), - *pRight = GetSubNode(2); + SmNode *pLeft = LeftOperand(), + *pOper = Symbol(), + *pRight = RightOperand(); assert(pLeft); assert(pOper); assert(pRight); diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 87d177bcce1f..cf3e92ec3241 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -2185,9 +2185,9 @@ void SmNodeToTextVisitor::Visit( SmUnHorNode* pNode ) void SmNodeToTextVisitor::Visit( SmBinHorNode* pNode ) { - SmNode *pLeft = pNode->GetSubNode( 0 ), - *pOper = pNode->GetSubNode( 1 ), - *pRight = pNode->GetSubNode( 2 ); + SmNode *pLeft = pNode->LeftOperand(), + *pOper = pNode->Symbol(), + *pRight = pNode->RightOperand(); Separate( ); pLeft->Accept( this ); Separate( ); |