summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/AccessibilityIssue.hxx10
-rw-r--r--svx/uiconfig/ui/accessibilitycheckentry.ui13
-rw-r--r--sw/CppunitTest_sw_uwriter.mk1
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/AccessibilityCheckStrings.hrc2
-rw-r--r--sw/source/core/access/AccessibilityIssue.cxx33
-rw-r--r--sw/source/core/inc/AccessibilityIssue.hxx3
-rw-r--r--sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx10
-rw-r--r--sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx2
9 files changed, 75 insertions, 0 deletions
diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx
index d1bf1ee11766..f6290ae9a01e 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -11,7 +11,10 @@
#pragma once
#include <sfx2/dllapi.h>
+
+#include <vcl/weld.hxx>
#include <rtl/ustring.hxx>
+
#include <vector>
#include <memory>
@@ -46,8 +49,15 @@ public:
virtual bool canGotoIssue() const = 0;
virtual void gotoIssue() const = 0;
+ virtual bool canQuickFixIssue() const = 0;
+ virtual void quickFixIssue() const = 0;
+
+ virtual void setParent(weld::Window* pParent) { m_pParent = pParent; }
+
AccessibilityIssueID m_eIssueID;
OUString m_aIssueText;
+
+ weld::Window* m_pParent;
};
class SFX2_DLLPUBLIC AccessibilityIssueCollection
diff --git a/svx/uiconfig/ui/accessibilitycheckentry.ui b/svx/uiconfig/ui/accessibilitycheckentry.ui
index 410e639fab0a..19f14d8f3779 100644
--- a/svx/uiconfig/ui/accessibilitycheckentry.ui
+++ b/svx/uiconfig/ui/accessibilitycheckentry.ui
@@ -41,5 +41,18 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="accessibilityCheckEntryFixButton">
+ <property name="label" translatable="yes" context="accessibilitycheckentry|accessibilityCheckEntryFixButton">Fix</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</interface>
diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk
index 7b328c998fe3..40e6db025fc6 100644
--- a/sw/CppunitTest_sw_uwriter.mk
+++ b/sw/CppunitTest_sw_uwriter.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uwriter, \
$(call gb_Helper_optional,AVMEDIA,avmedia) \
basegfx \
comphelper \
+ cui \
cppu \
cppuhelper \
$(call gb_Helper_optional,DBCONNECTIVITY, \
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 5abd6bb541d7..bc0067dcb8a8 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_libraries,sw,\
comphelper \
cppu \
cppuhelper \
+ cui \
$(call gb_Helper_optional,DBCONNECTIVITY, \
dbtools) \
docmodel \
diff --git a/sw/inc/AccessibilityCheckStrings.hrc b/sw/inc/AccessibilityCheckStrings.hrc
index bfd0557d8a98..805f525b37e2 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -41,6 +41,8 @@
#define STR_STYLE_NO_LANGUAGE NC_("STR_STYLE_NO_LANGUAGE", "Style “%STYLE_NAME%” has no language set.")
#define STR_DOCUMENT_TITLE NC_("STR_DOCUMENT_TITLE", "Document title is not set.")
+#define STR_ENTER_ALT NC_("STR_ENTER_ALT", "Enter alternative text:")
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx
index f8b8e3858013..628a77e4f2ff 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -9,9 +9,12 @@
*/
#include <AccessibilityIssue.hxx>
+#include <AccessibilityCheckStrings.hrc>
+#include <swtypes.hxx>
#include <wrtsh.hxx>
#include <docsh.hxx>
#include <comphelper/lok.hxx>
+#include <cui/dlgname.hxx>
namespace sw
{
@@ -84,6 +87,36 @@ void AccessibilityIssue::gotoIssue() const
}
}
+bool AccessibilityIssue::canQuickFixIssue() const
+{
+ return m_eIssueObject == IssueObject::GRAPHIC || m_eIssueObject == IssueObject::OLE;
+}
+
+void AccessibilityIssue::quickFixIssue() const
+{
+ if (!m_pDoc)
+ return;
+
+ switch (m_eIssueObject)
+ {
+ 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));
+ m_pDoc->SetFlyFrameTitle(*pFlyFormat, aNameDialog.GetName());
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
} // end sw namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/AccessibilityIssue.hxx b/sw/source/core/inc/AccessibilityIssue.hxx
index 870ad2364692..9cffdd405b9a 100644
--- a/sw/source/core/inc/AccessibilityIssue.hxx
+++ b/sw/source/core/inc/AccessibilityIssue.hxx
@@ -59,6 +59,9 @@ public:
bool canGotoIssue() const override;
void gotoIssue() const override;
+ bool canQuickFixIssue() const override;
+ void quickFixIssue() const override;
+
sal_Int32 getStart() { return m_nStart; }
sal_Int32 getEnd() { return m_nEnd; }
SwNode* getNode() { return m_pNode; }
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 82e7f903ac80..9392bad44ed3 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -31,6 +31,7 @@ AccessibilityCheckEntry::AccessibilityCheckEntry(
, m_xContainer(m_xBuilder->weld_container("accessibilityCheckEntryBox"))
, m_xLabel(m_xBuilder->weld_label("accessibilityCheckEntryLabel"))
, m_xGotoButton(m_xBuilder->weld_button("accessibilityCheckEntryGotoButton"))
+ , m_xFixButton(m_xBuilder->weld_button("accessibilityCheckEntryFixButton"))
, m_pAccessibilityIssue(rAccessibilityIssue)
{
m_xLabel->set_label(m_pAccessibilityIssue->m_aIssueText);
@@ -38,6 +39,10 @@ AccessibilityCheckEntry::AccessibilityCheckEntry(
m_xContainer->set_size_request(-1, m_xContainer->get_preferred_size().Height());
m_xGotoButton->set_visible(m_pAccessibilityIssue->canGotoIssue());
m_xGotoButton->connect_clicked(LINK(this, AccessibilityCheckEntry, GotoButtonClicked));
+ m_xFixButton->set_visible(m_pAccessibilityIssue->canQuickFixIssue());
+ m_xFixButton->connect_clicked(LINK(this, AccessibilityCheckEntry, FixButtonClicked));
+
+ m_pAccessibilityIssue->setParent(dynamic_cast<weld::Window*>(get_widget()));
}
IMPL_LINK_NOARG(AccessibilityCheckEntry, GotoButtonClicked, weld::Button&, void)
@@ -45,6 +50,11 @@ IMPL_LINK_NOARG(AccessibilityCheckEntry, GotoButtonClicked, weld::Button&, void)
m_pAccessibilityIssue->gotoIssue();
}
+IMPL_LINK_NOARG(AccessibilityCheckEntry, FixButtonClicked, weld::Button&, void)
+{
+ m_pAccessibilityIssue->quickFixIssue();
+}
+
std::unique_ptr<PanelLayout> A11yCheckIssuesPanel::Create(weld::Widget* pParent,
SfxBindings* pBindings)
{
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
index 23bf6468f196..21ffe9fbc057 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
@@ -29,6 +29,7 @@ private:
std::unique_ptr<weld::Container> m_xContainer;
std::unique_ptr<weld::Label> m_xLabel;
std::unique_ptr<weld::Button> m_xGotoButton;
+ std::unique_ptr<weld::Button> m_xFixButton;
std::shared_ptr<sfx::AccessibilityIssue> const& m_pAccessibilityIssue;
@@ -39,6 +40,7 @@ public:
weld::Widget* get_widget() const { return m_xContainer.get(); }
DECL_LINK(GotoButtonClicked, weld::Button&, void);
+ DECL_LINK(FixButtonClicked, weld::Button&, void);
};
class A11yCheckIssuesPanel : public PanelLayout,