sw/source/uibase/utlui/content.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 40fa74fc468ba18c75e8547faff41710ae6fbbef
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Mon Nov 8 15:21:29 2021 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Thu Nov 11 06:59:21 2021 +0100

    SwNavigator: Don't include Postit fields in Fields member count
    
    To determine if the Navigator content tree needs refreshed, content
    type members arrays are filled with current document content and
    compared with content in the Navigator content tree. If the member
    count between the members in the content type array and the members in
    the content type in the tree differs, the tree is updated and
    redisplayed.
    
    This patch fixes a bug that the Fields content members array count
    includes Postit fields but Postit fields are not included in the tree
    members for the Fields content type. This causes the count in the
    Fields content type members array to always be different than the
    number of members in the Fields content type in the tree when there are
    Postit fields in the document.
    
    Change-Id: I399619f78ee1fc91729a47d403ae403cda9f95cc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124894
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 313c123bd932..f877617e13a5 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -396,7 +396,6 @@ void SwContentType::Init(bool* pbInvalidateWindow)
         break;
         case ContentTypeId::TEXTFIELD:
         {
-            m_nMemberCount = 0;
             m_sTypeToken.clear();
             m_bEdit = true;
             m_bDelete = true;
@@ -409,7 +408,8 @@ void SwContentType::Init(bool* pbInvalidateWindow)
                 pFieldType->GatherFields(vFields);
                 for (SwFormatField* pFormatField: vFields)
                 {
-                    if (pFormatField->GetTextField())
+                    SwField* pField = pFormatField->GetField();
+                    if (pField && pField->GetTypeId() != 
SwFieldTypesEnum::Postit)
                         m_nMemberCount++;
                 }
             }
@@ -793,7 +793,9 @@ void SwContentType::FillMemberList(bool* 
pbLevelOrVisibilityChanged)
                 pFieldType->GatherFields(vFields);
                 for (SwFormatField* pFormatField: vFields)
                 {
-                    if (SwTextField* pTextField = pFormatField->GetTextField())
+                    SwTextField* pTextField = pFormatField->GetTextField();
+                    SwField* pField = pFormatField->GetField();
+                    if (pTextField && pField && pField->GetTypeId() != 
SwFieldTypesEnum::Postit)
                     {
                         const SwTextNode& rTextNode = 
pTextField->GetTextNode();
                         std::unique_ptr<SetGetExpField>
@@ -807,8 +809,6 @@ void SwContentType::FillMemberList(bool* 
pbLevelOrVisibilityChanged)
                 const SwTextField* pTextField = aSrtLst[i]->GetTextField();
                 const SwFormatField& rFormatField = 
pTextField->GetFormatField();
                 const SwField* pField = rFormatField.GetField();
-                if (pField->GetTypeId() == SwFieldTypesEnum::Postit)
-                    continue;
                 OUString sExpandedField(pField->ExpandField(true, 
m_pWrtShell->GetLayout()));
                 if (!sExpandedField.isEmpty())
                     sExpandedField = u" - " + sExpandedField;

Reply via email to