summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJuergen Funk <juergen.funk_ml@cib.de>2024-10-15 10:57:15 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-10-17 13:53:28 +0200
commit7303a0375bb3ae087fb4ff77d0efc9182c60a372 (patch)
treedd99d81fd601424218669f8d216d204c6fb4f00d /sw
parentc349892967ca97748fcd065918ada191c234b7c4 (diff)
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.extern@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/basesh.cxx23
1 files changed, 9 insertions, 14 deletions
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 1a7fc5b6c197..25a4465f30b0 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -292,29 +292,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::Fieldmark* 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)