summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/Library_comphelper.mk1
-rw-r--r--comphelper/source/misc/AccessibleImplementationHelper.cxx44
-rw-r--r--include/comphelper/AccessibleImplementationHelper.hxx42
-rw-r--r--winaccessibility/source/UAccCOM/AccActionBase.cxx21
-rw-r--r--winaccessibility/source/UAccCOM/AccActionBase.h2
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx3
6 files changed, 92 insertions, 21 deletions
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 388e036d64c8..04b333db9af9 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -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 \
diff --git a/comphelper/source/misc/AccessibleImplementationHelper.cxx b/comphelper/source/misc/AccessibleImplementationHelper.cxx
new file mode 100644
index 000000000000..ceba64e04800
--- /dev/null
+++ b/comphelper/source/misc/AccessibleImplementationHelper.cxx
@@ -0,0 +1,44 @@
+/* -*- 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: */
diff --git a/include/comphelper/AccessibleImplementationHelper.hxx b/include/comphelper/AccessibleImplementationHelper.hxx
new file mode 100644
index 000000000000..b2a54d7f02dc
--- /dev/null
+++ b/include/comphelper/AccessibleImplementationHelper.hxx
@@ -0,0 +1,42 @@
+/* -*- 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: */
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 <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: */
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<css::accessibility::XAccessibleAction> 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 <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) );
}
}
}