From 1019fc891964b97c1d43e7113a7d64e5d8d56084 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 1 Oct 2018 12:37:25 +0200 Subject: Move GetkeyBindingStrByXkeyBinding to comphelper So that it is available to other a11y implementations as well Change-Id: Ib82c4861cf9e0e90c64703b13c46548a080ffd10 Reviewed-on: https://gerrit.libreoffice.org/61198 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- winaccessibility/source/UAccCOM/AccActionBase.cxx | 21 +++------------------ winaccessibility/source/UAccCOM/AccActionBase.h | 2 -- winaccessibility/source/UAccCOM/MAccessible.cxx | 3 ++- 3 files changed, 5 insertions(+), 21 deletions(-) (limited to 'winaccessibility/source') diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx index 660e084edf81..514824cd4bdc 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.cxx +++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx @@ -30,6 +30,7 @@ #include #include +#include #include "AccessibleKeyStroke.h" @@ -175,7 +176,8 @@ STDMETHODIMP CAccActionBase::get_keyBinding( for( int index = 0;index < nCount;index++ ) { - auto const wString = GetkeyBindingStrByXkeyBinding( binding.get()->getAccessibleKeyBinding(index) ); + auto const wString = comphelper::GetkeyBindingStrByXkeyBinding( + binding.get()->getAccessibleKeyBinding(index)); (*keyBinding)[index] = SysAllocString(o3tl::toW(wString.getStr())); } @@ -216,21 +218,4 @@ STDMETHODIMP CAccActionBase::put_XInterface(hyper pXInterface) LEAVE_PROTECTED_BLOCK } -/** - * Helper function used for converting keybinding to string. - * - * @param keySet the key stroke sequence. - */ -OUString CAccActionBase::GetkeyBindingStrByXkeyBinding( const Sequence< KeyStroke > &keySet ) -{ - OUStringBuffer buf; - for( int iIndex = 0;iIndex < keySet.getLength();iIndex++ ) - { - KeyStroke stroke = keySet[iIndex]; - buf.append('\n'); - buf.append(stroke.KeyChar); - } - return buf.makeStringAndClear(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/UAccCOM/AccActionBase.h b/winaccessibility/source/UAccCOM/AccActionBase.h index 56a4980842d8..e804c3a14945 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.h +++ b/winaccessibility/source/UAccCOM/AccActionBase.h @@ -64,8 +64,6 @@ public: // Override of IUNOXWrapper. STDMETHOD(put_XInterface)(hyper pXInterface) override; - static OUString GetkeyBindingStrByXkeyBinding( const css::uno::Sequence< css::awt::KeyStroke > &keySet ); - protected: css::uno::Reference pRXAct; diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 9ec187480861..1f6e36531d17 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -650,7 +651,7 @@ STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKe long nCount = binding->getAccessibleKeyBindingCount(); if(nCount >= 1) { - wString = CAccAction::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0) ); + wString = comphelper::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0) ); } } } -- cgit