Kaydet (Commit) 1019fc89 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 0e204fa4
......@@ -89,6 +89,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/accessibletexthelper \
comphelper/source/misc/accessiblewrapper \
comphelper/source/misc/accimplaccess \
comphelper/source/misc/AccessibleImplementationHelper \
comphelper/source/misc/anytostring \
comphelper/source/misc/asyncnotification \
comphelper/source/misc/automationinvokedzone \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <comphelper/AccessibleImplementationHelper.hxx>
#include <com/sun/star/awt/KeyStroke.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustrbuf.hxx>
using namespace css::awt;
using namespace css::uno;
namespace comphelper
{
OUString 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 cinoptions=b1,g0,N-s cinkeys+=0=break: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_COMPHELPER_ACESSIBLEIMPLEMENTATIONHELPER_HXX
#define INCLUDED_COMPHELPER_ACESSIBLEIMPLEMENTATIONHELPER_HXX
#include <com/sun/star/awt/KeyStroke.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <comphelper/comphelperdllapi.h>
#include <rtl/ustring.hxx>
namespace comphelper
{
/**
* Helper function used for converting keybinding to string.
*
* @param keySet the key stroke sequence.
*/
COMPHELPER_DLLPUBLIC OUString
GetkeyBindingStrByXkeyBinding(const css::uno::Sequence<css::awt::KeyStroke>& keySet);
}
#endif // INCLUDED_COMPHELPER_ACESSIBLEIMPLEMENTATIONHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -30,6 +30,7 @@
#include <vcl/svapp.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <comphelper/AccessibleImplementationHelper.hxx>
#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: */
......@@ -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<css::accessibility::XAccessibleAction> pRXAct;
......
......@@ -45,6 +45,7 @@
#include <vcl/svapp.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <comphelper/AccessibleImplementationHelper.hxx>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
......@@ -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) );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment