diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-08-12 16:07:26 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-08-13 07:18:21 +0200 |
commit | c7060bf1b2cab506a81fdfc40296f3d3e1867898 (patch) | |
tree | ae912f61acc08cd624a3ed277b35a81541e7657f /winaccessibility/source | |
parent | b2a4833ee2a52358ad3dba170d9e4b34cc87c136 (diff) |
wina11y: clang-format CAccHyperLink
This in particular ensures that try and catch blocks
are indented by an additional indentation level
as expected, increasing readability.
Change-Id: I8cfe89e80b9d8713a69037f1f5bda9ee7eaf782a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171797
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility/source')
-rw-r--r-- | winaccessibility/source/UAccCOM/AccHyperLink.cxx | 212 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccHyperLink.h | 62 |
2 files changed, 143 insertions, 131 deletions
diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.cxx b/winaccessibility/source/UAccCOM/AccHyperLink.cxx index 40a5280c2c02..dfd32ca8ef39 100644 --- a/winaccessibility/source/UAccCOM/AccHyperLink.cxx +++ b/winaccessibility/source/UAccCOM/AccHyperLink.cxx @@ -18,7 +18,7 @@ */ #include "stdafx.h" -#include <UAccCOM.h> +#include <UAccCOM.h> #include "AccHyperLink.h" #include <vcl/svapp.hxx> @@ -36,9 +36,8 @@ using namespace com::sun::star::awt; * * @param nActions the number of action. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* nActions) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/ long* nActions) { - return CAccActionBase::nActions(nActions); } @@ -49,7 +48,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* */ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long actionIndex) { - return CAccActionBase::doAction(actionIndex); } @@ -59,21 +57,20 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long action * @param actionIndex the index of action. * @param description the description string of the specified action. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_description(long actionIndex,BSTR __RPC_FAR *description) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_description(long actionIndex, + BSTR __RPC_FAR* description) { - return CAccActionBase::get_description(actionIndex, description); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_name( long actionIndex, BSTR __RPC_FAR *name) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_name(long actionIndex, BSTR __RPC_FAR* name) { - return CAccActionBase::get_name(actionIndex, name); } -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName) +COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName(long actionIndex, + BSTR __RPC_FAR* localizedName) { - return CAccActionBase::get_name(actionIndex, localizedName); } @@ -90,10 +87,9 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName( long actionI COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_keyBinding( /* [in] */ long actionIndex, /* [in] */ long nMaxBinding, - /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding, - /* [retval][out] */ long __RPC_FAR *nBinding) + /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR* __RPC_FAR* keyBinding, + /* [retval][out] */ long __RPC_FAR* nBinding) { - return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding, keyBinding, nBinding); } @@ -102,30 +98,34 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_keyBinding( * @param * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchor) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_anchor(/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchor) { SolarMutexGuard g; - try { - - if(anchor == nullptr) + try { - return E_INVALIDARG; - } + if (anchor == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + // Get Any type value via pRXLink. + css::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index); + // Convert Any to VARIANT. + CMAccessible::ConvertAnyToVariant(anyVal, anchor); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - // Get Any type value via pRXLink. - css::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index); - // Convert Any to VARIANT. - CMAccessible::ConvertAnyToVariant(anyVal, anchor); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -133,53 +133,60 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long inde * @param * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_anchorTarget(/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchorTarget) { SolarMutexGuard g; - try { - - if(anchorTarget == nullptr) + try { - return E_INVALIDARG; - } + if (anchorTarget == nullptr) + { + return E_INVALIDARG; + } - if(!pRXLink.is()) + if (!pRXLink.is()) + { + return E_FAIL; + } + // Get Any type value via pRXLink. + css::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index); + // Convert Any to VARIANT. + CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget); + + return S_OK; + } + catch (...) { return E_FAIL; } - // Get Any type value via pRXLink. - css::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index); - // Convert Any to VARIANT. - CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget); - - return S_OK; - - } catch(...) { return E_FAIL; } } - /** * Get start index. * @param index Variant to get start index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR* index) { SolarMutexGuard g; - try { + try + { + if (index == nullptr) + { + return E_INVALIDARG; + } + *index = GetXInterface()->getStartIndex(); - if(index == nullptr) + return S_OK; + } + catch (...) { - return E_INVALIDARG; + return E_FAIL; } - *index = GetXInterface()->getStartIndex(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -187,26 +194,30 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] * @param index Variant to get end index. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR* index) { SolarMutexGuard g; - try { - - if(index == nullptr) + try { - return E_INVALIDARG; - } + if (index == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + *index = GetXInterface()->getEndIndex(); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - *index = GetXInterface()->getEndIndex(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -214,26 +225,30 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] * * @param valid Variant to get validity. * @return Result. */ -COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid) +COM_DECLSPEC_NOTHROW STDMETHODIMP +CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR* valid) { SolarMutexGuard g; - try { - - if(valid == nullptr) + try { - return E_INVALIDARG; - } + if (valid == nullptr) + { + return E_INVALIDARG; + } + + if (!pRXLink.is()) + { + return E_FAIL; + } + *valid = GetXInterface()->isValid(); - if(!pRXLink.is()) + return S_OK; + } + catch (...) { return E_FAIL; } - *valid = GetXInterface()->isValid(); - - return S_OK; - - } catch(...) { return E_FAIL; } } /** @@ -245,28 +260,31 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::put_XInterface(hyper pXInterfac { // internal IUNOXWrapper - no mutex meeded - try { - - CAccActionBase::put_XInterface(pXInterface); - //special query. - if(pUNOInterface != nullptr) + try { - Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); - if( !pRContext.is() ) + CAccActionBase::put_XInterface(pXInterface); + //special query. + if (pUNOInterface != nullptr) { - return E_FAIL; + Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext(); + if (!pRContext.is()) + { + return E_FAIL; + } + Reference<XAccessibleHyperlink> pRXI(pRContext, UNO_QUERY); + if (!pRXI.is()) + { + pRXLink = nullptr; + } + else + pRXLink = pRXI.get(); } - Reference<XAccessibleHyperlink> pRXI(pRContext,UNO_QUERY); - if( !pRXI.is() ) - { - pRXLink = nullptr; - } - else - pRXLink = pRXI.get(); + return S_OK; + } + catch (...) + { + return E_FAIL; } - return S_OK; - - } catch(...) { return E_FAIL; } } /** diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.h b/winaccessibility/source/UAccCOM/AccHyperLink.h index 42d65a833577..aa425be0fd62 100644 --- a/winaccessibility/source/UAccCOM/AccHyperLink.h +++ b/winaccessibility/source/UAccCOM/AccHyperLink.h @@ -19,7 +19,7 @@ #pragma once -#include "Resource.h" // main symbols +#include "Resource.h" // main symbols #include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> #include "AccActionBase.h" @@ -28,16 +28,13 @@ /** * CAccHyperLink implements IAccessibleHyperlink interface. */ -class ATL_NO_VTABLE CAccHyperLink : - public CComObjectRoot, - public CComCoClass<CAccHyperLink,&CLSID_AccHyperLink>, - public IAccessibleHyperlink, - public CAccActionBase +class ATL_NO_VTABLE CAccHyperLink : public CComObjectRoot, + public CComCoClass<CAccHyperLink, &CLSID_AccHyperLink>, + public IAccessibleHyperlink, + public CAccActionBase { public: - CAccHyperLink() - { - } + CAccHyperLink() {} BEGIN_COM_MAP(CAccHyperLink) COM_INTERFACE_ENTRY(IAccessibleAction) @@ -54,16 +51,15 @@ public: DECLARE_NO_REGISTRY() - static HRESULT WINAPI SmartQI_(void* pv, - REFIID iid, void** ppvObject, DWORD_PTR) + static HRESULT WINAPI SmartQI_(void* pv, REFIID iid, void** ppvObject, DWORD_PTR) { - return static_cast<CAccHyperLink*>(pv)->SmartQI(iid,ppvObject); + return static_cast<CAccHyperLink*>(pv)->SmartQI(iid, ppvObject); } HRESULT SmartQI(REFIID iid, void** ppvObject) { - if( m_pOuterUnknown ) - return OuterQueryInterface(iid,ppvObject); + if (m_pOuterUnknown) + return OuterQueryInterface(iid, ppvObject); return E_FAIL; } @@ -72,49 +68,52 @@ public: // IAccessibleAction // Returns the number of action. - STDMETHOD(nActions)(/*[out,retval]*/long* nActions) override; + STDMETHOD(nActions)(/*[out,retval]*/ long* nActions) override; // Performs specified action on the object. STDMETHOD(doAction)(/* [in] */ long actionIndex) override; // get the action name - STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name) override; + STDMETHOD(get_name)(long actionIndex, BSTR __RPC_FAR* name) override; // get the localized action name - STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName) override; + STDMETHOD(get_localizedName)(long actionIndex, BSTR __RPC_FAR* localizedName) override; // Gets description of specified action. - STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description) override; + STDMETHOD(get_description)(long actionIndex, BSTR __RPC_FAR* description) override; // Returns key binding object (if any) associated with specified action // key binding is string. // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut). - STDMETHOD(get_keyBinding)( + STDMETHOD(get_keyBinding) + ( /* [in] */ long actionIndex, /* [in] */ long nMaxBinding, - /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding, - /* [retval][out] */ long __RPC_FAR *nBinding) override; + /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR* __RPC_FAR* keyBinding, + /* [retval][out] */ long __RPC_FAR* nBinding) override; // IAccessibleHyperlink // get an object, e.g. BSTR or image object, that is overloaded with link behavior - STDMETHOD(get_anchor)(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchor) override; + STDMETHOD(get_anchor) + (/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchor) override; // get an object representing the target of the link, usually a BSTR of the URI - STDMETHOD(get_anchorTarget)(/* [in] */ long index, - /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget) override; + STDMETHOD(get_anchorTarget) + (/* [in] */ long index, + /* [retval][out] */ VARIANT __RPC_FAR* anchorTarget) override; // Returns the index at which the textual representation of the // hyperlink (group) starts. - STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR *index) override; + STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR* index) override; // Returns the index at which the textual representation of the // hyperlink (group) ends. - STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR *index) override; + STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR* index) override; // Returns whether the document referenced by this links is still valid. - STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR *valid) override; + STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR* valid) override; // Override of IUNOXWrapper. STDMETHOD(put_XInterface)(hyper pXInterface) override; @@ -123,14 +122,9 @@ public: STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override; private: - css::uno::Reference<css::accessibility::XAccessibleHyperlink> pRXLink; - css::accessibility::XAccessibleHyperlink* GetXInterface() - { - return pRXLink.get(); - } - + css::accessibility::XAccessibleHyperlink* GetXInterface() { return pRXLink.get(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |