sw/source/uibase/shells/basesh.cxx | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
New commits: commit d41ee7f5751350896e13dc621df2d22204b3fcf3 Author: Juergen Funk <juergen.funk...@cib.de> AuthorDate: Tue Oct 15 10:57:15 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Fri Oct 25 15:35:34 2024 +0200 tdf#160163 improvment when reset placeholder in Text field - this patch improve e8a271dd53d605a835c493eef5c34e4fb077f16d when replace the empty-placholder, it was missing the selection of the whole placeholders. - with this change have solved a other problem, when select with the field with mouse or tab, and press backspace, then the cursor has the wrong position, after tip text the view was wrong. - reduce code Change-Id: I6c2c7b2849298552770ea2d257ab844d250a97a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174965 Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175533 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 30a6883bf307..43e3e09cdc1a 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -291,29 +291,24 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq) //#i42732# - notify the edit window that from now on we do not use the input language rTmpEditWin.SetUseInputLanguage( false ); - std::function<void(SwPosition* sp, const IDocumentMarkAccess* pMarksAccess)> - NoEmptyTextField = [](SwPosition* sp, const IDocumentMarkAccess* pMarksAccess) + // Test Fieldmark when empty reset the Placeholders + const IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess(); + for (SwPaM &rPaM : rSh.GetCursor()->GetRingContainer()) { + const SwPosition* sp = rPaM.Start(); // Legacy text/combo/checkbox: never return read-only when inside these form fields. sw::mark::IFieldmark* pA = pMarksAccess->getInnerFieldmarkFor(*sp); if (pA != nullptr) { - bool fm = IDocumentMarkAccess::GetType(*pA) == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK; - if ((pA->GetContent().getLength() == 0) && fm) + if ((IDocumentMarkAccess::GetType(*pA) == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK) && + (pA->GetContent().getLength() == 0) + ) { pA->ReplaceContent(vEnSpaces); - }; + rSh.GotoFieldmark(pA); + } } - }; - - const IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess(); - for (SwPaM& rPaM : rSh.GetCursor()->GetRingContainer()) - { - auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition* - NoEmptyTextField(pStt, pMarksAccess); - NoEmptyTextField(pEnd, pMarksAccess); } - } void SwBaseShell::ExecClpbrd(SfxRequest &rReq)