diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-10 12:07:09 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-12 15:02:01 +0200 |
commit | fcb36a995dde68456b862db8a931b98176f9eca7 (patch) | |
tree | db766dfd83c1111fbcc00025ae24a25ec15355c2 /sw | |
parent | 7de96e9f7b69354fd5b15e1276678000bc386568 (diff) |
MSForms: date field: handle replacing empty content
It occurs when the date field is empty and the user trying to
set a date with the date picker.
Change-Id: I182930258b05071d861c2b326c139c73e2339af9
Reviewed-on: https://gerrit.libreoffice.org/75461
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 61784376509e..85228b5fc195 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -634,12 +634,18 @@ namespace sw { namespace mark const sal_Int32 nStart(GetMarkStart().nContent.GetIndex()); const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex()); - if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength()) + if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() && + nEnd > nStart + 2) { SwPaM aFieldPam(GetMarkStart().nNode, nStart + 1, GetMarkStart().nNode, nEnd - 1); m_pDocumentContentOperationsManager->ReplaceRange(aFieldPam, sNewContent, false); } + else + { + SwPaM aFieldStartPam(GetMarkStart().nNode, nStart + 1); + m_pDocumentContentOperationsManager->InsertString(aFieldStartPam, sNewContent); + } } |