diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-11-08 15:21:29 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-11-11 06:59:21 +0100 |
commit | 40fa74fc468ba18c75e8547faff41710ae6fbbef (patch) | |
tree | f9f21d7d874918b8cafc8fa0bcaf86948744ce37 /sw | |
parent | 07a2afa4904ac51c9c61aaf41a9d6c7d41126531 (diff) |
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 <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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; |