comphelper/Library_comphelper.mk                          |    1 
 comphelper/source/misc/AccessibleImplementationHelper.cxx |   44 ++++++++++++++
 include/comphelper/AccessibleImplementationHelper.hxx     |   42 +++++++++++++
 winaccessibility/source/UAccCOM/AccActionBase.cxx         |   21 ------
 winaccessibility/source/UAccCOM/AccActionBase.h           |    2 
 winaccessibility/source/UAccCOM/MAccessible.cxx           |    3 
 6 files changed, 92 insertions(+), 21 deletions(-)

New commits:
commit 1019fc891964b97c1d43e7113a7d64e5d8d56084
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Mon Oct 1 12:37:25 2018 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Oct 2 12:22:25 2018 +0200

    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 <samuel.mehrbr...@cib.de>

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) 
);
                             }
                         }
                     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to