starmath: Fix invalid static_cast

It was an undefined behavior that static_cast'ing a pointer to
SmVisibleNode to SmStructureNode's.

Change-Id: Ic391175a5535cec84bd7f9ec58fa13a411398331
Reviewed-on: https://gerrit.libreoffice.org/26676
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index fa79f55..72da13b 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -114,13 +114,12 @@ class SmNode : public SmRect
    FontAttribute   mnAttributes;
    bool            mbIsPhantom;
    bool            mbIsSelected;
    // index in accessible text; -1 if not (yet) applicable
    sal_Int32       mnAccIndex;

protected:
    SmNode(SmNodeType eNodeType, const SmToken &rNodeToken);

    // index in accessible text -1 if not (yet) applicable
    sal_Int32       mnAccIndex;

public:
    SmNode(const SmNode&) = delete;
    SmNode& operator=(const SmNode&) = delete;
@@ -174,6 +173,7 @@ public:

    virtual void    GetAccessibleText( OUStringBuffer &rText ) const = 0;
    sal_Int32       GetAccessibleIndex() const { return mnAccIndex; }
    void            SetAccessibleIndex(sal_Int32 nAccIndex) { mnAccIndex = nAccIndex; }
    const SmNode *  FindNodeWithAccessibleIndex(sal_Int32 nAccIndex) const;

    sal_uInt16  GetRow() const    { return sal::static_int_cast<sal_uInt16>(maNodeToken.nRow); }
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index f378e4d..8300752 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -429,7 +429,7 @@ void SmStructureNode::GetAccessibleText( OUStringBuffer &rText ) const
                   [&rText](SmNode *pNode)
        {
            if (pNode->IsVisible())
                static_cast<SmStructureNode *>(pNode)->mnAccIndex = rText.getLength();
                pNode->SetAccessibleIndex(rText.getLength());
            pNode->GetAccessibleText( rText );
        });
}