diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-22 15:59:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-24 18:19:29 +0100 |
commit | f920e86fbf3968104e1dfc0e9934e80652ed0837 (patch) | |
tree | 01f8ed9c445821739b9709c5fee6e51eab0ae24d /vcl | |
parent | da881f38c088c439f034e340bbbb4ca53e67389f (diff) |
weld SvxSearchDialog
I have to use the other way to specify an a11y role, both are implemented in
the vcl parser, but in my gtk3-3.24.7 the role tag crashes the gtk parser,
while the other route works fine.
The CONTENT_FLOWS_TO accessibility relation is another additional complexity
over the norm
Change-Id: Ia096bcbe9f00f9944e4e4d5ad9bb1a52d19c7b3f
Reviewed-on: https://gerrit.libreoffice.org/69569
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/window.h | 3 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 28 |
6 files changed, 65 insertions, 6 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index ecc28c7dcc98..bee0f55f1425 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -275,7 +275,8 @@ public: css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer; css::uno::Reference< css::accessibility::XAccessible > mxAccessible; std::shared_ptr< VclSizeGroup > m_xSizeGroup; - std::vector< VclPtr<FixedText> > m_aMnemonicLabels; + std::vector<VclPtr<FixedText>> m_aMnemonicLabels; + std::vector<css::accessibility::AccessibleRelation> m_aExtraAccessibleRelations; std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos; VCLXWindow* mpVCLXWindow; vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6a27b64f2974..01069b134a81 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -480,6 +480,16 @@ public: m_xWidget->SetAccessibleRelationLabelFor(pAtkLabeled); } + virtual void add_extra_accessible_relation(const css::accessibility::AccessibleRelation &rRelation) override + { + m_xWidget->AddExtraAccessibleRelation(rRelation); + } + + virtual void clear_extra_accessible_relations() override + { + m_xWidget->ClearExtraAccessibleRelations(); + } + virtual void set_tooltip_text(const OUString& rTip) override { m_xWidget->SetQuickHelpText(rTip); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 66df5fa5781f..dfcec76e9b48 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -45,6 +45,7 @@ #include <salframe.hxx> #include <scrwnd.hxx> +#include <com/sun/star/accessibility/AccessibleRelation.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> using namespace com::sun::star; @@ -1946,6 +1947,21 @@ const std::vector<VclPtr<FixedText> >& Window::list_mnemonic_labels() const return mpWindowImpl->m_aMnemonicLabels; } +void Window::AddExtraAccessibleRelation(const css::accessibility::AccessibleRelation &rRelation) +{ + mpWindowImpl->m_aExtraAccessibleRelations.push_back(rRelation); +} + +const std::vector<css::accessibility::AccessibleRelation>& Window::GetExtraAccessibleRelations() const +{ + return mpWindowImpl->m_aExtraAccessibleRelations; +} + +void Window::ClearExtraAccessibleRelations() +{ + mpWindowImpl->m_aExtraAccessibleRelations.clear(); +} + } /* namespace vcl */ void DrawFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 2aa1e50bc6c7..a6382c8b2ef6 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -496,8 +496,8 @@ wrapper_get_index_in_parent( AtkObject *atk_obj ) /*****************************************************************************/ -static void -relation_set_add(AtkRelationSet *pSet, const accessibility::AccessibleRelation& rRelation) +AtkRelation* +atk_object_wrapper_relation_new(const accessibility::AccessibleRelation& rRelation) { sal_uInt32 nTargetCount = rRelation.TargetSet.getLength(); @@ -515,8 +515,8 @@ relation_set_add(AtkRelationSet *pSet, const accessibility::AccessibleRelation& aTargets.data(), nTargetCount, mapRelationType( rRelation.RelationType ) ); - atk_relation_set_add( pSet, pRel ); - g_object_unref( G_OBJECT( pRel ) ); + + return pRel; } static AtkRelationSet * @@ -540,7 +540,9 @@ wrapper_ref_relation_set( AtkObject *atk_obj ) sal_Int32 nRelations = xRelationSet.is() ? xRelationSet->getRelationCount() : 0; for( sal_Int32 n = 0; n < nRelations; n++ ) { - relation_set_add(pSet, xRelationSet->getRelation(n)); + AtkRelation *pRel = atk_object_wrapper_relation_new(xRelationSet->getRelation(n)); + atk_relation_set_add(pSet, pRel); + g_object_unref(pRel); } } catch(const uno::Exception &) { diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx index ef33397fa48c..8725e54ccf5b 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.hxx +++ b/vcl/unx/gtk/a11y/atkwrapper.hxx @@ -98,6 +98,8 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper); AtkStateType mapAtkState( sal_Int16 nState ); +AtkRelation* atk_object_wrapper_relation_new(const css::accessibility::AccessibleRelation& rRelation); + void actionIfaceInit(AtkActionIface *iface); void componentIfaceInit(AtkComponentIface *iface); void editableTextIfaceInit(AtkEditableTextIface *iface); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 18aaf556223d..d7286685dbcb 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1299,6 +1299,7 @@ private: gulong m_nDragLeaveSignalId; rtl::Reference<GtkDropTarget> m_xDropTarget; + std::vector<AtkRelation*> m_aExtraAtkRelations; static void signalSizeAllocate(GtkWidget*, GdkRectangle* allocation, gpointer widget) { @@ -1758,6 +1759,33 @@ public: g_object_unref(pRelationSet); } + virtual void add_extra_accessible_relation(const css::accessibility::AccessibleRelation &rRelation) override + { + AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); + if (!pAtkObject) + return; + + AtkRelationSet *pRelationSet = atk_object_ref_relation_set(pAtkObject); + AtkRelation *pRel = atk_object_wrapper_relation_new(rRelation); + m_aExtraAtkRelations.push_back(pRel); + atk_relation_set_add(pRelationSet, pRel); + g_object_unref(pRel); + g_object_unref(pRelationSet); + } + + virtual void clear_extra_accessible_relations() override + { + AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); + if (!pAtkObject) + return; + + AtkRelationSet *pRelationSet = atk_object_ref_relation_set(pAtkObject); + for (AtkRelation* pRel : m_aExtraAtkRelations) + atk_relation_set_remove(pRelationSet, pRel); + m_aExtraAtkRelations.clear(); + g_object_unref(pRelationSet); + } + virtual bool get_extents_relative_to(weld::Widget& rRelative, int& x, int &y, int& width, int &height) override { //for toplevel windows this is sadly futile under wayland, so we can't tell where a dialog is in order to allow |