winaccessibility/Library_uacccom.mk             |    1 +
 winaccessibility/source/UAccCOM/MAccessible.cxx |   19 +++++++------------
 2 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 235b30bdfa76b5c0514c7dfe2a0d13ab8ecf5be2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Sep 9 23:04:19 2022 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Sep 10 07:21:17 2022 +0200

    wina11y: Report actual app/toolkit name/version
    
    The previous way of reporting "Hannover" as app name, "3.0" as
    version and no toolkit name and version looks rather arbitrary.
    
    Can be queried e.g. from NVDA's Python console as follows after
    pressing Keypad_Insert+Ctrl+Z with any LibreOffice UI element focused:
    
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appName
        'Hannover'
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appVersion
        '3.0'
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitName
        ' '
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitVersion
        ' '
    
    Report the actual app name and version. For the toolkit use "VCL"
    as name and the same version that LibreOffice has:
    
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appName
        'LibreOfficeDev'
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appVersion
        '7.5'
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitName
        'VCL'
        >>> 
focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitVersion
        '7.5'
    
    Change-Id: I3c6bdb79e6b945c0f9707bfa7bada0fb456d6e05
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139743
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/Library_uacccom.mk 
b/winaccessibility/Library_uacccom.mk
index 8c3d3c1596e5..0fb07814b2f9 100644
--- a/winaccessibility/Library_uacccom.mk
+++ b/winaccessibility/Library_uacccom.mk
@@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,UAccCOM,\
        comphelper \
        cppu \
        sal \
+       utl \
 ))
 
 $(eval $(call gb_Library_use_externals,UAccCOM,\
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx 
b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 2b11d2ed7d12..3cb544f3ba80 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -45,6 +45,7 @@
 
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
+#include <unotools/configmgr.hxx>
 #include <vcl/svapp.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
 #include <comphelper/AccessibleImplementationHelper.hxx>
@@ -3033,7 +3034,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CMAccessible::get_appName(BSTR __RPC_FAR *name
         if(name == nullptr)
             return E_INVALIDARG;
 
-        *name = SysAllocString(OLESTR("Hannover"));
+        static const OUString sAppName = utl::ConfigManager::getProductName();
+        *name = SysAllocString(o3tl::toW(sAppName.getStr()));
         return S_OK;
     } catch(...) { return E_FAIL; }
 }
@@ -3045,7 +3047,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CMAccessible::get_appVersion(BSTR __RPC_FAR *v
         if (m_isDestroy) return S_FALSE;
         if(version == nullptr)
             return E_INVALIDARG;
-        *version=SysAllocString(OLESTR("3.0"));
+        static const OUString sVersion = 
utl::ConfigManager::getProductVersion();
+        *version=SysAllocString(o3tl::toW(sVersion.getStr()));
         return S_OK;
     } catch(...) { return E_FAIL; }
 }
@@ -3057,21 +3060,13 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CMAccessible::get_toolkitName(BSTR __RPC_FAR *
         if (m_isDestroy) return S_FALSE;
         if(name == nullptr)
             return E_INVALIDARG;
-        *name = SysAllocString(OLESTR(" "));
+        *name = SysAllocString(OLESTR("VCL"));
         return S_OK;
     } catch(...) { return E_FAIL; }
 }
 COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_toolkitVersion(BSTR 
__RPC_FAR *version)
 {
-    SolarMutexGuard g;
-
-    try {
-        if (m_isDestroy) return S_FALSE;
-        if(version == nullptr)
-            return E_INVALIDARG;
-        *version = SysAllocString(OLESTR(" "));
-        return S_OK;
-    } catch(...) { return E_FAIL; }
+    return get_appVersion(version);
 }
 
 

Reply via email to