summaryrefslogtreecommitdiff
path: root/winaccessibility/source/UAccCOM/AccRelation.cxx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-08-20 17:10:55 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-08-21 07:46:26 +0200
commit8fd7eed3020841f4094e6d4882a03ad220f16794 (patch)
treed021d0646dde123e57a074840497af2680ee298f /winaccessibility/source/UAccCOM/AccRelation.cxx
parent399ed986e5a15988c8b08dc715ad698ef3f4fe83 (diff)
wina11y: clang-format CAccRelation
This in particular ensures that try and catch blocks are indented by an additional indentation level as expected, increasing readability. Change-Id: Ic2c3c1500c07df75e3b606ab957a44b220f52194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172150 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility/source/UAccCOM/AccRelation.cxx')
-rw-r--r--winaccessibility/source/UAccCOM/AccRelation.cxx192
1 files changed, 103 insertions, 89 deletions
diff --git a/winaccessibility/source/UAccCOM/AccRelation.cxx b/winaccessibility/source/UAccCOM/AccRelation.cxx
index 4312491595bd..4b6545721a8e 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.cxx
+++ b/winaccessibility/source/UAccCOM/AccRelation.cxx
@@ -18,7 +18,7 @@
*/
#include "stdafx.h"
-#include <UAccCOM.h>
+#include <UAccCOM.h>
#include "AccRelation.h"
#include <vcl/svapp.hxx>
@@ -36,34 +36,38 @@ using namespace com::sun::star::uno;
* @param relationType Variant to get relation type.
* @return Result.
*/
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_relationType(BSTR * relationType)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_relationType(BSTR* relationType)
{
SolarMutexGuard g;
- try {
-
- if (relationType == nullptr)
- return E_INVALIDARG;
-
- int type = relation.RelationType;
- SysFreeString(*relationType);
+ try
+ {
+ if (relationType == nullptr)
+ return E_INVALIDARG;
- *relationType = getRelationTypeBSTR(type);
- return S_OK;
+ int type = relation.RelationType;
+ SysFreeString(*relationType);
- } catch(...) { return E_FAIL; }
+ *relationType = getRelationTypeBSTR(type);
+ return S_OK;
+ }
+ catch (...)
+ {
+ return E_FAIL;
+ }
}
// Gets what the type of localized relation is.
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR *)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR*)
{
-
-
- try {
-
- return S_OK;
-
- } catch(...) { return E_FAIL; }
+ try
+ {
+ return S_OK;
+ }
+ catch (...)
+ {
+ return E_FAIL;
+ }
}
/**
@@ -71,20 +75,23 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR *
* @param nTargets Variant to get targets length.
* @return Result.
*/
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_nTargets(long* nTargets)
{
SolarMutexGuard g;
- try {
-
- if (nTargets == nullptr)
- return E_INVALIDARG;
-
- Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
- *nTargets = xTargets.getLength();
- return S_OK;
+ try
+ {
+ if (nTargets == nullptr)
+ return E_INVALIDARG;
- } catch(...) { return E_FAIL; }
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
+ *nTargets = xTargets.getLength();
+ return S_OK;
+ }
+ catch (...)
+ {
+ return E_FAIL;
+ }
}
/**
@@ -93,32 +100,35 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
* @param target Variant to get special target.
* @return Result.
*/
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown * * target)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown** target)
{
SolarMutexGuard g;
- try {
+ try
+ {
+ if (target == nullptr)
+ return E_FAIL;
- if (target == nullptr)
- return E_FAIL;
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
+ int nCount = xTargets.getLength();
+ if (targetIndex >= nCount)
+ return E_FAIL;
- Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
- int nCount = xTargets.getLength();
- if( targetIndex >= nCount )
- return E_FAIL;
+ Reference<XAccessible> xRAcc = xTargets[targetIndex];
+ IAccessible* pRet = CMAccessible::get_IAccessibleFromXAccessible(xRAcc.get());
+ if (pRet)
+ {
+ *target = pRet;
+ pRet->AddRef();
+ return S_OK;
+ }
- Reference<XAccessible> xRAcc = xTargets[targetIndex];
- IAccessible* pRet = CMAccessible::get_IAccessibleFromXAccessible(xRAcc.get());
- if (pRet)
+ return E_FAIL;
+ }
+ catch (...)
{
- *target = pRet;
- pRet->AddRef();
- return S_OK;
+ return E_FAIL;
}
-
- return E_FAIL;
-
- } catch(...) { return E_FAIL; }
}
/**
@@ -128,40 +138,43 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_target(long targetIndex, IUn
* @param nTargets Variant to accept actual target length.
* @return Result.
*/
-COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * target, long * nTargets)
+COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_targets(long, IUnknown** target, long* nTargets)
{
SolarMutexGuard g;
- try {
+ try
+ {
+ if (target == nullptr)
+ return E_INVALIDARG;
+ if (nTargets == nullptr)
+ return E_INVALIDARG;
- if(target == nullptr)
- return E_INVALIDARG;
- if (nTargets == nullptr)
- return E_INVALIDARG;
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
+ int nCount = xTargets.getLength();
- Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
- int nCount = xTargets.getLength();
+ *target = static_cast<IUnknown*>(::CoTaskMemAlloc(nCount * sizeof(IUnknown)));
- *target = static_cast<IUnknown*>(::CoTaskMemAlloc(nCount*sizeof(IUnknown)));
+ // #CHECK Memory Allocation#
+ if (*target == nullptr)
+ {
+ return E_FAIL;
+ }
- // #CHECK Memory Allocation#
- if(*target == nullptr)
- {
- return E_FAIL;
- }
+ for (int i = 0; i < nCount; i++)
+ {
+ IUnknown* pAcc = nullptr;
+ HRESULT hr = get_target(i, &pAcc);
+ if (SUCCEEDED(hr))
+ target[i] = pAcc;
+ }
- for(int i=0; i<nCount ; i++)
+ *nTargets = nCount;
+ return S_OK;
+ }
+ catch (...)
{
- IUnknown* pAcc = nullptr;
- HRESULT hr = get_target(i,&pAcc);
- if(SUCCEEDED(hr))
- target[i] = pAcc;
+ return E_FAIL;
}
-
- *nTargets = nCount;
- return S_OK;
-
- } catch(...) { return E_FAIL; }
}
/**
@@ -184,23 +197,24 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::put_XSubInterface(hyper pXSubInt
*/
BSTR CAccRelation::getRelationTypeBSTR(int type)
{
- static LPCWSTR map[] =
- {
- L"INVALID", // AccessibleRelationType::INVALID
- IA2_RELATION_FLOWS_FROM, // AccessibleRelationType::CONTENT_FLOWS_FROM
- IA2_RELATION_FLOWS_TO, // AccessibleRelationType::CONTENT_FLOWS_TO
- IA2_RELATION_CONTROLLED_BY, // AccessibleRelationType::CONTROLLED_BY
- IA2_RELATION_CONTROLLER_FOR, // AccessibleRelationType::CONTROLLER_FOR
- IA2_RELATION_LABEL_FOR, // AccessibleRelationType::LABEL_FOR
- IA2_RELATION_LABELED_BY, // AccessibleRelationType::LABELED_BY
- IA2_RELATION_MEMBER_OF, // AccessibleRelationType::MEMBER_OF
- IA2_RELATION_SUBWINDOW_OF, // AccessibleRelationType::SUB_WINDOW_OF
- IA2_RELATION_NODE_CHILD_OF, // AccessibleRelationType::NODE_CHILD_OF
- IA2_RELATION_DESCRIBED_BY // AccessibleRelationType::DESCRIBED_BY
- };
-
- return ::SysAllocString( (type >= AccessibleRelationType::INVALID && type <= AccessibleRelationType::DESCRIBED_BY)
- ? map[type] : L"");
+ static LPCWSTR map[] = {
+ L"INVALID", // AccessibleRelationType::INVALID
+ IA2_RELATION_FLOWS_FROM, // AccessibleRelationType::CONTENT_FLOWS_FROM
+ IA2_RELATION_FLOWS_TO, // AccessibleRelationType::CONTENT_FLOWS_TO
+ IA2_RELATION_CONTROLLED_BY, // AccessibleRelationType::CONTROLLED_BY
+ IA2_RELATION_CONTROLLER_FOR, // AccessibleRelationType::CONTROLLER_FOR
+ IA2_RELATION_LABEL_FOR, // AccessibleRelationType::LABEL_FOR
+ IA2_RELATION_LABELED_BY, // AccessibleRelationType::LABELED_BY
+ IA2_RELATION_MEMBER_OF, // AccessibleRelationType::MEMBER_OF
+ IA2_RELATION_SUBWINDOW_OF, // AccessibleRelationType::SUB_WINDOW_OF
+ IA2_RELATION_NODE_CHILD_OF, // AccessibleRelationType::NODE_CHILD_OF
+ IA2_RELATION_DESCRIBED_BY // AccessibleRelationType::DESCRIBED_BY
+ };
+
+ return ::SysAllocString(
+ (type >= AccessibleRelationType::INVALID && type <= AccessibleRelationType::DESCRIBED_BY)
+ ? map[type]
+ : L"");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */