winaccessibility/source/UAccCOM/MAccessible.cxx | 43 ++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-)
New commits: commit a8e75a8ac93c18a7e955e448bfd120d0ed9ef0b0 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 20 12:56:39 2023 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Oct 21 13:48:50 2023 +0200 wina11y: Just return empty attr string when none present If the `XAccessibleExtendedAttributes` interface isn't implemented, just return an empty string for the attributes instead of an error code. (This seems like a totally valid case to me, no need to report an error.) Change-Id: I986f030bc7a01da0fdd92a5aa2b4cf3c0d6a9200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 98f15fdf230b..30e9b043b0fb 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -2721,10 +2721,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *p { return E_FAIL; } + + OUString sAttributes; Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY); - if( !pRXI.is() ) - return E_FAIL; - else + if (pRXI.is()) { css::uno::Reference<css::accessibility::XAccessibleExtendedAttributes> pRXAttr; pRXAttr = pRXI.get(); @@ -2732,13 +2732,14 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *p OUString val; anyVal >>= val; + sAttributes += val; + } - if(*pAttr) - SysFreeString(*pAttr); - *pAttr = SysAllocString(o3tl::toW(val.getStr())); + if (*pAttr) + SysFreeString(*pAttr); + *pAttr = SysAllocString(o3tl::toW(sAttributes.getStr())); - return S_OK; - } + return S_OK; } catch(...) { return E_FAIL; } } commit eff3e9b8a576863c01f4244a5628cda64f48a363 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Oct 20 12:52:03 2023 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Oct 21 13:48:42 2023 +0200 wina11y: Indent try block Change-Id: I89a4ed514e1c24e683b081d04f72cd62ede80065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158257 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index e8f29c8192d2..98f15fdf230b 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -2711,34 +2711,34 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *p SolarMutexGuard g; try { - if (m_isDestroy) return S_FALSE; + if (m_isDestroy) return S_FALSE; - if (!m_xAccessible.is()) - return E_FAIL; + if (!m_xAccessible.is()) + return E_FAIL; - Reference<XAccessibleContext> pRContext = m_xAccessible->getAccessibleContext(); - if( !pRContext.is() ) - { - return E_FAIL; - } - Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY); - if( !pRXI.is() ) - return E_FAIL; - else - { - css::uno::Reference<css::accessibility::XAccessibleExtendedAttributes> pRXAttr; - pRXAttr = pRXI.get(); - css::uno::Any anyVal = pRXAttr->getExtendedAttributes(); + Reference<XAccessibleContext> pRContext = m_xAccessible->getAccessibleContext(); + if( !pRContext.is() ) + { + return E_FAIL; + } + Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY); + if( !pRXI.is() ) + return E_FAIL; + else + { + css::uno::Reference<css::accessibility::XAccessibleExtendedAttributes> pRXAttr; + pRXAttr = pRXI.get(); + css::uno::Any anyVal = pRXAttr->getExtendedAttributes(); - OUString val; - anyVal >>= val; + OUString val; + anyVal >>= val; - if(*pAttr) - SysFreeString(*pAttr); - *pAttr = SysAllocString(o3tl::toW(val.getStr())); + if(*pAttr) + SysFreeString(*pAttr); + *pAttr = SysAllocString(o3tl::toW(val.getStr())); - return S_OK; - } + return S_OK; + } } catch(...) { return E_FAIL; } }
