From 5a7157d319477830426797532e02ac39d3b859f4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:29:03 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sw/source/uibase/docvw/edtwin.cxx | 63 +++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'sw/source/uibase/docvw') diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 322928eb4e..073b6b5964 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -896,6 +896,25 @@ void SwEditWin::FlushInBuffer() return; SwWrtShell& rSh = m_rView.GetWrtShell(); + uno::Reference xRecorder + = m_rView.GetViewFrame().GetBindings().GetRecorder(); + + comphelper::ScopeGuard showTooltipGuard( + [this, &rSh] + { + SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get(); + const bool bAutoTextShown + = rACfg.IsAutoTextTip() && ShowAutoText(rSh.GetChunkForAutoText()); + if (!bAutoTextShown) + { + SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect(); + if (pACorr && pACorr->GetSwFlags().bAutoCompleteWords) + ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr); + } + }); + if (!m_bMaybeShowTooltipAfterBufferFlush || xRecorder) + showTooltipGuard.dismiss(); + m_bMaybeShowTooltipAfterBufferFlush = false; // generate new sequence input checker if not already done if ( !pCheckIt ) @@ -993,8 +1012,6 @@ void SwEditWin::FlushInBuffer() } } - uno::Reference< frame::XDispatchRecorder > xRecorder = - m_rView.GetViewFrame().GetBindings().GetRecorder(); if ( xRecorder.is() ) { // determine shell @@ -1381,6 +1398,9 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) } } + // Do not show autotext / word completion tooltips in intermediate flushes + m_bMaybeShowTooltipAfterBufferFlush = false; + sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode(); if (nKey == KEY_ESCAPE) @@ -2821,19 +2841,12 @@ KEYINPUT_CHECKTABLE_INSDEL: if( KEY_UP == nKey || KEY_DOWN == nKey || KEY_PAGEUP == nKey || KEY_PAGEDOWN == nKey ) GetView().GetViewFrame().GetBindings().Update( FN_STAT_PAGE ); + m_bMaybeShowTooltipAfterBufferFlush = bNormalChar; + // in case the buffered characters are inserted if( bFlushBuffer && !m_aInBuffer.isEmpty() ) { FlushInBuffer(); - - // maybe show Tip-Help - if (bNormalChar) - { - const bool bAutoTextShown - = pACfg && pACfg->IsAutoTextTip() && ShowAutoText(rSh.GetChunkForAutoText()); - if (!bAutoTextShown && pACorr && pACorr->GetSwFlags().bAutoCompleteWords) - ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr); - } } // get the word count dialog to update itself @@ -4662,19 +4675,23 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) SdrObject* pObj = pSdrView ? pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER) : nullptr; if (pObj) { - SwFrameFormat* pFormat = GetUserCall(pObj)->GetFormat(); - SwFrameFormat* pShapeFormat = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_FLYFRMFMT); - if (!pShapeFormat) - { - pSdrView->UnmarkAllObj(); - pSdrView->MarkObj(pObj,pPV); - } - else + if (SwDrawContact* pContact = static_cast(GetUserCall(pObj))) { - // If the fly frame is a textbox of a shape, then select the shape instead. - SdrObject* pShape = pShapeFormat->FindSdrObject(); - pSdrView->UnmarkAllObj(); - pSdrView->MarkObj(pShape, pPV); + SwFrameFormat* pFormat = pContact->GetFormat(); + SwFrameFormat* pShapeFormat + = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_FLYFRMFMT); + if (!pShapeFormat) + { + pSdrView->UnmarkAllObj(); + pSdrView->MarkObj(pObj, pPV); + } + else + { + // If the fly frame is a textbox of a shape, then select the shape instead. + SdrObject* pShape = pShapeFormat->FindSdrObject(); + pSdrView->UnmarkAllObj(); + pSdrView->MarkObj(pShape, pPV); + } } } } -- cgit v1.2.3