sw/source/uibase/utlui/content.cxx | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
New commits: commit b8ac21a3981b9d6fd94aa74c4da9026e580f44eb Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Mon Jul 25 19:12:13 2022 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Wed Jul 27 05:53:16 2022 +0200 tdf#149916 revert to showing text of referenced text node reverts cross-ref field listings in the Navigator to pre commit 21b5d6e0dce7c2034aded96d1499da27094e2781 A static_cast is used in place of a dynamic_cast which should provide for reduced time to fill the fields members list for documents with cross reference fields which was the main purpose for commit 21b5d6e0dce7c2034aded96d1499da27094e2781 Change-Id: If2734386de463a1280d835cab54f95e8bd7fab5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137444 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 1a459205742b..a20e792a9fbd 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -683,16 +683,33 @@ void SwContentType::FillMemberList(bool* pbContentChanged) } else if (pField->GetTypeId() == SwFieldTypesEnum::GetRef) { - OUString sFieldSubTypeOrName; - auto nSubType = pField->GetSubType(); - if (nSubType == REF_FOOTNOTE) - sFieldSubTypeOrName = SwResId(STR_FLDREF_FOOTNOTE); - else if (nSubType == REF_ENDNOTE) - sFieldSubTypeOrName = SwResId(STR_FLDREF_ENDNOTE); + const SwGetRefField* pRefField(static_cast<const SwGetRefField*>(pField)); + if (pRefField->IsRefToHeadingCrossRefBookmark() || + pRefField->IsRefToNumItemCrossRefBookmark()) + { + OUString sExpandedTextOfReferencedTextNode = + pRefField->GetExpandedTextOfReferencedTextNode( + *m_pWrtShell->GetLayout()); + if (sExpandedTextOfReferencedTextNode.getLength() > 80) + { + sExpandedTextOfReferencedTextNode = OUString::Concat( + sExpandedTextOfReferencedTextNode.subView(0, 80)) + u"..."; + } + sText = pField->GetDescription() + u" - " + sExpandedTextOfReferencedTextNode; + } else - sFieldSubTypeOrName = pField->GetFieldName(); - sText = pField->GetDescription() + u" - " + sFieldSubTypeOrName - + sExpandField; + { + OUString sFieldSubTypeOrName; + auto nSubType = pField->GetSubType(); + if (nSubType == REF_FOOTNOTE) + sFieldSubTypeOrName = SwResId(STR_FLDREF_FOOTNOTE); + else if (nSubType == REF_ENDNOTE) + sFieldSubTypeOrName = SwResId(STR_FLDREF_ENDNOTE); + else + sFieldSubTypeOrName = pField->GetFieldName(); + sText = pField->GetDescription() + u" - " + sFieldSubTypeOrName + + sExpandField; + } } else sText = pField->GetDescription() + u" - " + pField->GetFieldName()