summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-05-18 14:33:53 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-05-20 09:15:15 +0200
commit3a86bbd5e06d0fb7c057c761e924111e6499d20e (patch)
tree8dbb9e61a8ec40c25a8e29a330da0c1824edfa0f /sw/source/core
parent5d992d36412cd41e8489e98ee1d251125219073f (diff)
sw: fix not needed invalidation of title field on each keypressco-6.4-39
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. (cherry picked from commit 0a32630d11ebdb8b8218faa066c72582ef2f300d) Conflicts: sw/qa/core/txtnode/txtnode.cxx sw/source/core/txtnode/atrfld.cxx Change-Id: I5e46ab6aef33ff5e348d40b8644bcc9cf353c326 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115783 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/txtnode/atrfld.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index ebcdced03c52..d5f76f7ce4bd 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -314,7 +314,23 @@ void SwFormatField::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
}
- const bool bForceNotify = (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 );
}