sw/source/core/access/AccessibilityCheck.cxx | 7 +++++-- sw/source/core/access/AccessibilityIssue.cxx | 10 ++++++++++ sw/source/core/inc/AccessibilityIssue.hxx | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-)
New commits: commit f551747116ab6d1d05b46fb4b3d0d66d180a01ec Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Fri Jun 30 12:51:45 2023 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Mon Jul 3 08:28:17 2023 +0200 tdf#156094 - Add "Go to" button to "Avoid footnotes" issues And the button points to the footnote anchor point in the text content. Change-Id: I3193714a69a432094cd194a60223b255a6c8f24d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153805 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 45dd076e99ce..450f657e13e6 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -1280,7 +1280,7 @@ public: void check(SwDoc* pDoc) override { - for (SwTextFootnote const* pTextFootnote : pDoc->GetFootnoteIdxs()) + for (SwTextFootnote* pTextFootnote : pDoc->GetFootnoteIdxs()) { SwFormatFootnote const& rFootnote = pTextFootnote->GetFootnote(); if (rFootnote.IsEndNote()) @@ -1289,7 +1289,10 @@ public: } else { - lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_FOOTNOTES)); + auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_FOOTNOTES)); + pIssue->setDoc(*pDoc); + pIssue->setIssueObject(IssueObject::FOOTNOTE); + pIssue->setTextFootnote(pTextFootnote); } } } diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx index 5776b3eea164..ebda9a25083b 100644 --- a/sw/source/core/access/AccessibilityIssue.cxx +++ b/sw/source/core/access/AccessibilityIssue.cxx @@ -31,6 +31,7 @@ AccessibilityIssue::AccessibilityIssue(sfx::AccessibilityIssueID eIssueID) , m_eIssueObject(IssueObject::UNKNOWN) , m_pDoc(nullptr) , m_pNode(nullptr) + , m_pTextFootnote(nullptr) , m_nStart(0) , m_nEnd(0) { @@ -118,6 +119,15 @@ void AccessibilityIssue::gotoIssue() const pWrtShell->ShowCursor(); } break; + case IssueObject::FOOTNOTE: + { + SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell(); + if (m_pTextFootnote) + pWrtShell->GotoFootnoteAnchor(*m_pTextFootnote); + if (comphelper::LibreOfficeKit::isActive()) + pWrtShell->ShowCursor(); + } + break; default: break; } diff --git a/sw/source/core/inc/AccessibilityIssue.hxx b/sw/source/core/inc/AccessibilityIssue.hxx index f38457acf0b6..5a6d3e772333 100644 --- a/sw/source/core/inc/AccessibilityIssue.hxx +++ b/sw/source/core/inc/AccessibilityIssue.hxx @@ -13,6 +13,7 @@ #include <sfx2/AccessibilityIssue.hxx> #include <doc.hxx> +#include <txtftn.hxx> namespace sw { @@ -26,6 +27,7 @@ enum class IssueObject TABLE, TEXT, DOCUMENT_TITLE, + FOOTNOTE, }; class SW_DLLPUBLIC AccessibilityIssue final : public sfx::AccessibilityIssue @@ -36,6 +38,7 @@ private: OUString m_sObjectID; std::vector<OUString> m_aIssueAdditionalInfo; SwNode* m_pNode; + SwTextFootnote* m_pTextFootnote; sal_Int32 m_nStart; sal_Int32 m_nEnd; @@ -47,6 +50,7 @@ public: void setDoc(SwDoc& rDoc); void setObjectID(OUString const& rID); void setNode(SwNode* pNode) { m_pNode = pNode; } + void setTextFootnote(SwTextFootnote* pTextFootnote) { m_pTextFootnote = pTextFootnote; } void setStart(sal_Int32 nStart) { m_nStart = nStart; } @@ -68,6 +72,7 @@ public: sal_Int32 getStart() { return m_nStart; } sal_Int32 getEnd() { return m_nEnd; } SwNode* getNode() { return m_pNode; } + SwTextFootnote* getTextFootnote() { return m_pTextFootnote; } }; } // end sw namespace