summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-03-09 19:47:13 +0900
committerCaolán McNamara <caolanm@redhat.com>2016-03-09 16:22:17 +0000
commit1de73e4ddfff3a67c9470e8434c2bb2cb3f43dd5 (patch)
tree50fa64f00a5c02df7dfed2a90b8fd9cd9afdeee0
parent4eb5f363ed9a3181a817f12d5ec49eede13b9c9c (diff)
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--starmath/inc/node.hxx2
-rw-r--r--starmath/source/cursor.cxx3
-rw-r--r--starmath/source/node.cxx15
3 files changed, 2 insertions, 18 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 4e38e4374be8..2fc3b660f1e6 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 4694254cfefc..34dd19fbe836 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 a85b845ff86d..855bb703f3ad 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)