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

Takeshi Abe tabe at fixedpoint.jp
Wed Mar 9 16:22:40 UTC 2016


 starmath/inc/node.hxx      |    2 --
 starmath/source/cursor.cxx |    3 ++-
 starmath/source/node.cxx   |   15 ---------------
 3 files changed, 2 insertions(+), 18 deletions(-)

New commits:
commit 1de73e4ddfff3a67c9470e8434c2bb2cb3f43dd5
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Mar 9 19:47:13 2016 +0900

    starmath: Drop SmNode::FindIndex
    
    Its sole usage can be replaced with SmNode::IndexOfSubNode.
    
    Change-Id: Icfd4a3fe846b585c5fa3f47e0768729aba66d73e
    Reviewed-on: https://gerrit.libreoffice.org/23064
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 4e38e43..2fc3b66 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -146,8 +146,6 @@ public:
     virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
     void PrepareAttributes();
 
-    sal_uInt16 FindIndex() const;
-
     void         SetRectHorAlign(RectHorAlign eHorAlign, bool bApplyToSubTree = true );
     RectHorAlign GetRectHorAlign() const { return meRectHorAlign; }
 
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 4694254..34dd19f 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -1488,7 +1488,8 @@ bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBra
             return false;
         }
 
-        sal_uInt16 index = pNode->FindIndex();
+        int index = pParentNode->IndexOfSubNode(pNode);
+        assert(index >= 0);
         if (index + 1 != pParentNode->GetNumSubNodes()) {
             // The cursor is not at the tail at one of ancestor nodes.
             return false;
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index a85b845..855bb70 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -258,21 +258,6 @@ void SmNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
     ForEachNonNull(this, [&rFormat, &rDocShell](SmNode *pNode){pNode->Prepare(rFormat, rDocShell);});
 }
 
-sal_uInt16 SmNode::FindIndex() const
-{
-    assert(mpParentNode != nullptr && "FindIndex() requires this is a subnode.");
-
-    for (sal_uInt16 i = 0; i < mpParentNode->GetNumSubNodes(); ++i) {
-        if (mpParentNode->GetSubNode(i) == this) {
-            return i;
-        }
-    }
-
-    assert(false && "Connection between parent and child is inconsistent.");
-    return 0;
-}
-
-
 void SmNode::Move(const Point& rPosition)
 {
     if (rPosition.X() == 0  &&  rPosition.Y() == 0)


More information about the Libreoffice-commits mailing list