summaryrefslogtreecommitdiff
path: root/sw/source/core/access
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-08-14 09:44:35 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-08-15 08:56:40 +0200
commite027ef6c0534b7ce50dc5f8b74e27ce85b9eb97b (patch)
tree5caa8cc32365fc6ae4af91f372f82ea03b96fd8f /sw/source/core/access
parent751104215e6c4b42b68dd255e48d771e319555b4 (diff)
tdf#156670 - A11Y - Open the Format->Description dialog with the fix button
The Fix button will open the Format->Description dialog in case of shapes, textBox, graphic, OLE objects. (Remove Description text from (AccessibilityTests1.odt) the shape for proper testing of no_alt_text.) Change-Id: I6678fa44a0a47bab60558f770cc709012f02d83b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155653 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sw/source/core/access')
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx3
-rw-r--r--sw/source/core/access/AccessibilityIssue.cxx66
2 files changed, 52 insertions, 17 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index eace70ef7cfc..c73de2bccfc6 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1517,8 +1517,7 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, SdrObject* pObject)
|| nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group
|| nObjId == SdrObjKind::Graphic || nInv == SdrInventor::FmForm)
{
- OUString sAlternative = pObject->GetTitle();
- if (sAlternative.isEmpty())
+ if (pObject->GetTitle().isEmpty() && pObject->GetDescription().isEmpty())
{
OUString sName = pObject->GetName();
OUString sIssueText = SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", sName);
diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx
index 2ec8b5f02e20..9da1952f95bc 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -26,6 +26,7 @@
#include <comphelper/lok.hxx>
#include <cui/dlgname.hxx>
#include <svx/svdpage.hxx>
+#include <svx/svxdlg.hxx>
namespace sw
{
@@ -160,29 +161,64 @@ void AccessibilityIssue::quickFixIssue() const
case IssueObject::GRAPHIC:
case IssueObject::OLE:
{
- OUString aDesc = SwResId(STR_ENTER_ALT);
- SvxNameDialog aNameDialog(m_pParent, "", aDesc);
- if (aNameDialog.run() == RET_OK)
+ SwFlyFrameFormat* pFlyFormat
+ = const_cast<SwFlyFrameFormat*>(m_pDoc->FindFlyByName(m_sObjectID));
+ if (pFlyFormat)
{
- SwFlyFrameFormat* pFlyFormat
- = const_cast<SwFlyFrameFormat*>(m_pDoc->FindFlyByName(m_sObjectID));
- if (pFlyFormat)
- m_pDoc->SetFlyFrameTitle(*pFlyFormat, aNameDialog.GetName());
+ OUString aDescription(pFlyFormat->GetObjDescription());
+ OUString aTitle(pFlyFormat->GetObjTitle());
+ bool isDecorative(pFlyFormat->IsDecorative());
+
+ SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(
+ pFact->CreateSvxObjectTitleDescDialog(pWrtShell->GetView().GetFrameWeld(),
+ aTitle, aDescription, isDecorative));
+
+ if (pDlg->Execute() == RET_OK)
+ {
+ pDlg->GetTitle(aTitle);
+ pDlg->GetDescription(aDescription);
+ pDlg->IsDecorative(isDecorative);
+
+ m_pDoc->SetFlyFrameTitle(*pFlyFormat, aTitle);
+ m_pDoc->SetFlyFrameDescription(*pFlyFormat, aDescription);
+ m_pDoc->SetFlyFrameDecorative(*pFlyFormat, isDecorative);
+
+ pWrtShell->SetModified();
+ }
}
}
break;
case IssueObject::SHAPE:
case IssueObject::FORM:
{
- 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)
{
- 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());
+ OUString aTitle(pObj->GetTitle());
+ OUString aDescription(pObj->GetDescription());
+ bool isDecorative(pObj->IsDecorative());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(
+ pFact->CreateSvxObjectTitleDescDialog(pWrtShell->GetView().GetFrameWeld(),
+ aTitle, aDescription, isDecorative));
+
+ if (RET_OK == pDlg->Execute())
+ {
+ pDlg->GetTitle(aTitle);
+ pDlg->GetDescription(aDescription);
+ pDlg->IsDecorative(isDecorative);
+
+ pObj->SetTitle(aTitle);
+ pObj->SetDescription(aDescription);
+ pObj->SetDecorative(isDecorative);
+
+ pWrtShell->SetModified();
+ }
}
}
break;