sw/source/uibase/docvw/edtwin.cxx   |   19 +++++++++++++++++++
 sw/source/uibase/shells/textidx.cxx |    2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 2a7fcaf582df3ada57ca519b50e29011973a1b6f
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Sat Oct 1 11:31:41 2022 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Sat Oct 1 21:58:17 2022 +0200

    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.heini...@yahoo.de>

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 1ceb7d70f827..d7fed1052210 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 590b9fa82f0b..299de33d1490 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
         {

Reply via email to