summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-05-19 10:24:32 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-05-19 11:13:24 +0200
commit1dcd3f1b9fc0d888e047e854a20e9ab2e0afd544 (patch)
tree268bb7e32005bf5d7218d5ddaf91877d6e66378d /sw
parent8356700d3a2d8be9c42c8d23247930ecadbb723d (diff)
sw: fix not needed invalidation of custom field on each keypress
And do the same for modification fields (e.g. modification date) and subject fields as well. In all cases the layout already reacts to the doc model change via normal notifications, no need to force anything. (Confirmed with manual testing.) This builds on top of commit 0a32630d11ebdb8b8218faa066c72582ef2f300d (sw: fix not needed invalidation of title field on each keypress, 2021-05-18). Change-Id: I8015b33a6680d75cd5b6446eb9275bb018ea7613 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115784 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/txtnode/data/title-field-invalidate.fodt4
-rw-r--r--sw/source/core/txtnode/atrfld.cxx14
2 files changed, 14 insertions, 4 deletions
diff --git a/sw/qa/core/txtnode/data/title-field-invalidate.fodt b/sw/qa/core/txtnode/data/title-field-invalidate.fodt
index e47129538fa9..e7d07cab7b63 100644
--- a/sw/qa/core/txtnode/data/title-field-invalidate.fodt
+++ b/sw/qa/core/txtnode/data/title-field-invalidate.fodt
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
+ <dc:subject>mysubject</dc:subject>
<dc:title>mytitle</dc:title>
+ <meta:user-defined meta:name="Version" meta:value-type="string">1.1</meta:user-defined>
</office:meta>
<office:automatic-styles>
<style:page-layout style:name="pm1">
@@ -11,7 +13,7 @@
<office:master-styles>
<style:master-page style:name="Standard" style:display-name="Standard" style:page-layout-name="pm1" style:next-style-name="Standard">
<style:footer>
- <text:p><text:title>mytitle</text:title></text:p>
+ <text:p><text:subject>mysubject</text:subject> <text:title>mytitle</text:title> <text:user-defined text:name="Version">1.1</text:user-defined> <text:modification-date>May 18, 2021</text:modification-date></text:p>
</style:footer>
</style:master-page>
</office:master-styles>
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 089f35c188d6..2124e55c7d65 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -380,16 +380,24 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
bool bForceNotify = pOld == nullptr && pNew == nullptr;
if (bForceNotify)
{
- // Force notify was added for conditional text fields, at least the title fields needs
+ // Force notify was added for conditional text fields, at least the below fields need
// 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)
+ sal_uInt16 nSubType = pDocInfoField->GetSubType();
+ // Do not consider extended SubTypes.
+ nSubType &= 0xff;
+ switch (nSubType)
{
- bForceNotify = false;
+ case nsSwDocInfoSubType::DI_TITLE:
+ case nsSwDocInfoSubType::DI_SUBJECT:
+ case nsSwDocInfoSubType::DI_CHANGE:
+ case nsSwDocInfoSubType::DI_CUSTOM:
+ bForceNotify = false;
+ break;
}
}
}