diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-06-01 14:54:07 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-06-05 08:18:51 +0200 |
commit | 1f09bab0d033953542d17987e1de56cebfa3497b (patch) | |
tree | 768fbe93563292739d0af4a2e3b3349608466bad | |
parent | 81f9e88e7237f54c636a018b413192f7fdefbaca (diff) |
tdf#155504 Add "Fix" function to shapes
Change-Id: I9494207b0bcdf121034f79d936aeadd95cecdf23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152494
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
-rw-r--r-- | include/svx/svdpage.hxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/access/AccessibilityIssue.cxx | 20 |
3 files changed, 31 insertions, 1 deletions
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 7443c408814d..778e8c2ee327 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -141,6 +141,7 @@ public: size_t GetObjCount() const; SdrObject* GetObj(size_t nNum) const; + SdrObject* GetObjByName(std::u16string_view sName) const; /// linked page or linked group object virtual bool IsReadOnly() const; diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 175f58b2ad7a..f7df7c12a730 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -789,6 +789,17 @@ SdrObject* SdrObjList::GetObj(size_t nNum) const return nullptr; } +SdrObject* SdrObjList::GetObjByName(std::u16string_view sName) const +{ + for (size_t i = 0; i < GetObjCount(); ++i) + { + SdrObject* pObj = GetObj(i); + if (pObj->GetName() == sName) + return pObj; + } + return nullptr; +} + bool SdrObjList::IsReadOnly() const { diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx index e11531ecd474..81072800d42d 100644 --- a/sw/source/core/access/AccessibilityIssue.cxx +++ b/sw/source/core/access/AccessibilityIssue.cxx @@ -10,13 +10,16 @@ #include <AccessibilityIssue.hxx> #include <AccessibilityCheckStrings.hrc> +#include <drawdoc.hxx> #include <edtwin.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <swtypes.hxx> #include <wrtsh.hxx> #include <docsh.hxx> #include <view.hxx> #include <comphelper/lok.hxx> #include <cui/dlgname.hxx> +#include <svx/svdpage.hxx> namespace sw { @@ -100,7 +103,8 @@ void AccessibilityIssue::gotoIssue() const bool AccessibilityIssue::canQuickFixIssue() const { - return m_eIssueObject == IssueObject::GRAPHIC || m_eIssueObject == IssueObject::OLE; + return m_eIssueObject == IssueObject::GRAPHIC || m_eIssueObject == IssueObject::OLE + || m_eIssueObject == IssueObject::SHAPE; } void AccessibilityIssue::quickFixIssue() const @@ -124,6 +128,20 @@ void AccessibilityIssue::quickFixIssue() const } } break; + case IssueObject::SHAPE: + { + OUString aDesc = SwResId(STR_ENTER_ALT); + SvxNameDialog aNameDialog(m_pParent, "", aDesc); + if (aNameDialog.run() == RET_OK) + { + SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell(); + auto pPage = pWrtShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObj = pPage->GetObjByName(m_sObjectID); + if (pObj) + pObj->SetTitle(aNameDialog.GetName()); + } + } + break; default: break; } |