From 2a7fcaf582df3ada57ca519b50e29011973a1b6f Mon Sep 17 00:00:00 2001 From: Andreas Heinisch Date: Sat, 1 Oct 2022 11:31:41 +0200 Subject: 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 --- sw/source/uibase/docvw/edtwin.cxx | 19 +++++++++++++++++++ sw/source/uibase/shells/textidx.cxx | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) 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 { -- cgit