sw/qa/core/txtnode/data/title-field-invalidate.fodt |    4 +++-
 sw/source/core/txtnode/atrfld.cxx                   |   14 +++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 93d6b09c33ae9f17e26266c3b8f7122a60a4ae0b
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed May 19 10:24:32 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri May 21 06:19:23 2021 +0200

    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).
    
    (cherry picked from commit 1dcd3f1b9fc0d888e047e854a20e9ab2e0afd544)
    
    Change-Id: I8015b33a6680d75cd5b6446eb9275bb018ea7613
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115874
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

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 bb95a8799081..98d4b235220f 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;
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to