From 4c2c900970d6484c6a92900213ece5c415e40f2d Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Tue, 19 Dec 2023 16:37:09 -0900 Subject: tdf#158114 SwNavigator: Make images with broken links easier to find This patch makes an icon display in image entries with broken links to make it easier to find images with broken links. Change-Id: I470c9959e169d4cc53a44e0a64e88af35e671db0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161045 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sw/inc/bitmaps.hlst | 1 + sw/source/uibase/utlui/content.cxx | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst index 50682d32ebc9..b1f30b0932f1 100644 --- a/sw/inc/bitmaps.hlst +++ b/sw/inc/bitmaps.hlst @@ -84,6 +84,7 @@ inline constexpr OUString RID_BMP_NAVI_TABLE = u"sw/res/nc20001.png"_ustr; inline constexpr OUString RID_BMP_NAVI_FRAME = u"sw/res/nc20002.png"_ustr; inline constexpr OUString RID_BMP_NAVI_GRAPHIC = u"sw/res/nc20003.png"_ustr; inline constexpr OUString RID_BMP_NAVI_GRAPHIC_LINK = u"sw/res/nc20007.png"_ustr; +inline constexpr OUString RID_BMP_NAVI_GRAPHIC_BROKENLINK = u"sw/res/brokenlink.png"_ustr; inline constexpr OUString RID_BMP_NAVI_OLE = u"sw/res/nc20004.png"_ustr; inline constexpr OUString RID_BMP_NAVI_BOOKMARK = u"sw/res/nc20005.png"_ustr; inline constexpr OUString RID_BMP_NAVI_REGION = u"sw/res/nc20006.png"_ustr; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 4ee3c315e4df..f182eee59cf1 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -121,6 +121,8 @@ #include +#include + #define CTYPE_CNT 0 #define CTYPE_CTT 1 @@ -593,7 +595,8 @@ void SwContentType::FillMemberList(bool* pbContentChanged) if(ContentTypeId::GRAPHIC == m_nContentType) { OUString sLink; - m_pWrtShell->GetGrfNms( &sLink, nullptr, static_cast( pFrameFormat)); + SwDoc::GetGrfNms(*static_cast(pFrameFormat), &sLink, + nullptr); pCnt = new SwGraphicContent(this, sFrameName, INetURLObject::decode(sLink, INetURLObject::DecodeMechanism::Unambiguous), nYPos); } @@ -2179,8 +2182,21 @@ void SwContentTree::InsertContent(const weld::TreeIter& rParent) OUString sId(weld::toId(pCnt)); insert(&rParent, sEntry, sId, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); - if (bGraphic && !static_cast(pCnt)->GetLink().isEmpty()) - m_xTreeView->set_image(*xChild, RID_BMP_NAVI_GRAPHIC_LINK); + if (bGraphic) + { + const OUString& rsURL = static_cast(pCnt)->GetLink(); + if (!rsURL.isEmpty()) + { + if (FStatHelper::IsDocument(rsURL)) + { + m_xTreeView->set_image(*xChild, RID_BMP_NAVI_GRAPHIC_LINK); + } + else + { + m_xTreeView->set_image(*xChild, RID_BMP_NAVI_GRAPHIC_BROKENLINK); + } + } + } } } -- cgit