Resolves: tdf#127003 explicit grab focus needs explicit link callback

Change-Id: I5131e5c49e7f7c2ef9bac8943420643ad8afef38
Reviewed-on: https://gerrit.libreoffice.org/77707
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index ce47f28..175c0fa4 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -71,6 +71,7 @@ public:
protected:
    virtual void makeEditEngine() override;
    virtual bool KeyInput( const KeyEvent& rKEvt ) override;
    virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
    virtual void GetFocus() override;
    virtual void LoseFocus() override;

diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index 9a41ffd..d0cc03a 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -252,6 +252,18 @@ void ScEditWindow::LoseFocus()
    WeldEditView::LoseFocus();
}

bool ScEditWindow::MouseButtonDown(const MouseEvent& rMEvt)
{
    bool bHadFocus = HasFocus();
    bool bRet = WeldEditView::MouseButtonDown(rMEvt);
    if (!bHadFocus)
    {
        assert(HasFocus());
        GetFocus();
    }
    return bRet;
}

css::uno::Reference< css::accessibility::XAccessible > ScEditWindow::CreateAccessible()
{
    pAcc = new ScAccessibleEditControlObject(this);