[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Fri Aug 5 05:20:27 UTC 2016


 starmath/inc/node.hxx        |   16 ++++++++--------
 starmath/source/node.cxx     |    6 +++---
 starmath/source/visitors.cxx |    6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit ce97110f37825f9666bff8ff2df0d2092620ae17
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Aug 4 18:22:51 2016 +0900

    starmath: SmBinHorNode's symbol is not always an SmMathSymbolNode
    
    E.g. it is an SmGlyphSpecialNode in the "boper" case.
    
    Change-Id: I6311e0dca8e71c617d2c4c681b0b049217ec9867

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index c22e9a7..e0b2019 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 c1d53f1..5b45745 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 87d177b..cf3e92e 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( );


More information about the Libreoffice-commits mailing list