summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-05-18 14:33:53 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-05-18 16:51:30 +0200
commit0a32630d11ebdb8b8218faa066c72582ef2f300d (patch)
treed4343e727fd9bb4f2fbf1610c95269a9e15dbe9a /sw/source/core/txtnode
parentacf309d7e45aeae87d8dee0dd2af3c9a86b9f652 (diff)
sw: fix not needed invalidation of title field on each keypress
Type a character, SwDocShell::DoFlushDocInfo() is called because the number of characters changed, and that rapaints all title fields. This happens as SwFormatField::UpdateTextNode() calls SwTextField::ExpandTextField() with bForceNotify=true, because that was needed for conditional text in commit cd94a84b89c476760ad74bf088a5d6f8ba4ce209 (125044: - use field's content cache on <SwTxtFld> construction only, 2014-06-13). Fix the problem by not forcing notifications for title fields in SwFormatField::UpdateTextNode(): SwTextField::ExpandTextField() will send a notification if the expend result differs without forcing as well. Change-Id: I5e46ab6aef33ff5e348d40b8644bcc9cf353c326 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115743 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r--sw/source/core/txtnode/atrfld.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 558874ad1784..089f35c188d6 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -377,7 +377,24 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
pTextNd->TriggerNodeUpdate(sw::LegacyModifyHint(pNodeOld, pNodeNew));
if(bExpand)
{
- mpTextField->ExpandTextField( pOld == nullptr && pNew == nullptr );
+ bool bForceNotify = pOld == nullptr && pNew == nullptr;
+ if (bForceNotify)
+ {
+ // Force notify was added for conditional text fields, at least the title fields needs
+ // no forced notify.
+ const SwField* pField = mpTextField->GetFormatField().GetField();
+ const SwFieldIds nWhich = pField->GetTyp()->Which();
+ if (nWhich == SwFieldIds::DocInfo)
+ {
+ auto pDocInfoField = static_cast<const SwDocInfoField*>(pField);
+ if (pDocInfoField->GetSubType() == nsSwDocInfoSubType::DI_TITLE)
+ {
+ bForceNotify = false;
+ }
+ }
+ }
+
+ mpTextField->ExpandTextField(bForceNotify);
}
}