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>
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 7443c40..778e8c2ee 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 175f58b..f7df7c1 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 e11531e..8107280 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;
    }