sw/source/core/inc/unoflatpara.hxx | 1 + sw/source/core/unocore/unoflatpara.cxx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
New commits: commit 90b35f89efb96e17b511f1dde7b69c467d0fd2b6 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Nov 28 13:59:22 2023 +0300 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed May 8 11:11:05 2024 +0200 tdf#153693: improve SwXFlatParagraph::isModified check The response from LanguageTool server may take some seconds, during which the user may type more characters of an unfinished word. A result of the check started using an incomplete text should be discarded in this case. The code in GrammarCheckingIterator::ProcessResult that applies the check results first calls isModified to decide if it should apply the result, or to discard it. Before the change, SwXFlatParagraph::isModified only checked that its underlying node is still referenced; but it could only get nullified in SwXTextMarkup::Impl::Notify (only when the node dies), or in SwXTextMarkup::ClearTextNode, called in SwXFlatParagraph::changeText and SwXFlatParagraph::changeAttributes. Any external changes of the node didn't mark SwXFlatParagraph "modified". This change stores the initial text of the paragraph, from the moment of creation of SwXFlatParagraph; and then compares it to the current text of the node in isModified. Change-Id: Ia9a2e74b256152fe311db874c66f7e5347183f12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160021 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 708e52a551daa27932dfae072a16e3512c72cf92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160032 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 9810b3c06c709ffef15932fe24106b503ea4ff46) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167072 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/source/core/inc/unoflatpara.hxx b/sw/source/core/inc/unoflatpara.hxx index 2cc2c354c292..e0c820a009d7 100644 --- a/sw/source/core/inc/unoflatpara.hxx +++ b/sw/source/core/inc/unoflatpara.hxx @@ -105,6 +105,7 @@ private: SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete; OUString maExpandText; + OUString maOrigText; }; class SwXFlatParagraphIterator final : diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index d5f3c9c4130b..5d7e2d0f5bca 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -68,6 +68,7 @@ CreateFlatParagraphIterator(SwDoc & rDoc, sal_Int32 const nTextMarkupType, SwXFlatParagraph::SwXFlatParagraph( SwTextNode& rTextNode, OUString aExpandText, const ModelToViewHelper& rMap ) : SwXFlatParagraph_Base(& rTextNode, rMap) , maExpandText(std::move(aExpandText)) + , maOrigText(rTextNode.GetText()) { } @@ -215,7 +216,7 @@ sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 nType ) sal_Bool SAL_CALL SwXFlatParagraph::isModified() { SolarMutexGuard aGuard; - return nullptr == GetTextNode(); + return !GetTextNode() || GetTextNode()->GetText() != maOrigText; } // text::XFlatParagraph: