include/svx/svdpage.hxx                      |    1 +
 svx/source/svdraw/svdpage.cxx                |   11 +++++++++++
 sw/source/core/access/AccessibilityIssue.cxx |   20 +++++++++++++++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 1f09bab0d033953542d17987e1de56cebfa3497b
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Jun 1 14:54:07 2023 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Jun 5 08:18:51 2023 +0200

    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.mehrbr...@allotropia.de>

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;
     }

Reply via email to