tdf#143158 - Handle double clicks on alphabetical indices

Open the edit index dialog when double-clicking an alphabetical index field.

Change-Id: Iaba398e485d2e7e848503189ad1f3b12975a5a71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140836
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 1ceb7d7..d7fed10 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3514,6 +3514,25 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                            }
                        }

                        // tdf#143158 - handle alphabetical index entries
                        SwContentAtPos aToxContentAtPos(IsAttrAtPos::ToxMark);
                        if (rSh.GetContentAtPos(aDocPos, aToxContentAtPos))
                        {
                            const OUString sToxText = aToxContentAtPos.sStr;
                            if (!sToxText.isEmpty() && aToxContentAtPos.pFndTextAttr)
                            {
                                const SwTOXType* pTType
                                    = aToxContentAtPos.pFndTextAttr->GetTOXMark().GetTOXType();
                                if (pTType && pTType->GetType() == TOXTypes::TOX_INDEX)
                                {
                                    RstMBDownFlags();
                                    GetView().GetViewFrame()->GetBindings().Execute(
                                        FN_EDIT_IDX_ENTRY_DLG);
                                    return;
                                }
                            }
                        }

                        g_bHoldSelection = true;
                        return;
                    }
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 590b9fa..299de33 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -196,7 +196,7 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet)

        bool bEnableEdit = true;
        bool bInReadonly = rSh.HasReadonlySel();
        if( rSh.HasSelection() || bInReadonly)
        if(bInReadonly)
            bEnableEdit = false;
        else
        {