Resolves: tdf#149482 don't insert if the mouse is not still pressed

In repeat callback, if we didn't see a mouse up, but find that the mouse
is no longer pressed at this point, then bail

Change-Id: I6e5d1d7201065fadcc2242fd52323ffb56766383
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146947
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index b09c748..a0995ee 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -884,6 +884,15 @@ void TabBar::ImplShowPage( sal_uInt16 nPos )

IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void )
{
    if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)) == 0)
    {
        // like tdf#149482 if we didn't see a mouse up, but find that the mouse is no
        // longer pressed at this point, then bail
        mpImpl->mxButtonBox->m_xPrevRepeater->Stop();
        mpImpl->mxButtonBox->m_xNextRepeater->Stop();
        return;
    }

    EndEditMode();

    sal_uInt16 nNewPos = mnFirstPos;
@@ -922,6 +931,14 @@ IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void )

IMPL_LINK_NOARG(TabBar, ImplAddClickHandler, weld::Button&, void)
{
    if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)) == 0)
    {
        // tdf#149482 if we didn't see a mouse up, but find that the mouse is no
        // longer pressed at this point, then bail
        mpImpl->mxButtonBox->m_xAddRepeater->Stop();
        return;
    }

    EndEditMode();
    AddTabClick();
}