solenv/clang-format/excludelist                 |    2 
 winaccessibility/source/UAccCOM/AccRelation.cxx |  186 ++++++++++++------------
 winaccessibility/source/UAccCOM/AccRelation.h   |   32 +---
 3 files changed, 107 insertions(+), 113 deletions(-)

New commits:
commit 98b4b2f4fa5bfc5a78a34847aeb274089e74f738
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 16:21:41 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:46:39 2024 +0200

    wina11y: Drop commented code and duplicate comment
    
    Change-Id: I192fe62a666c86654b0352d202675c33a72bf89e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172152
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/source/UAccCOM/AccRelation.h 
b/winaccessibility/source/UAccCOM/AccRelation.h
index 50605d86dd70..c96f33a2edc9 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.h
+++ b/winaccessibility/source/UAccCOM/AccRelation.h
@@ -53,7 +53,6 @@ public:
 #pragma clang diagnostic pop
 #endif
 
-    // IAccessibleRelation
 public:
     // IAccessibleRelation
 
@@ -75,7 +74,6 @@ public:
     // Override of IUNOXWrapper.
     STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override;
 
-    //static OLECHAR* getRelationTypeOLECHAR(int type);
     static BSTR getRelationTypeBSTR(int type);
 
 private:
commit d1843de829567e4216c782d241adb3de13eaea7a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 16:16:59 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:46:32 2024 +0200

    wina11y: Drop unnecessary try/catch
    
    Returning S_OK certainly won't throw.
    
    Change-Id: Ided99c26efb42cba21889890fa37d652d1e118ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172151
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/source/UAccCOM/AccRelation.cxx 
b/winaccessibility/source/UAccCOM/AccRelation.cxx
index 4b6545721a8e..464de28eda17 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.cxx
+++ b/winaccessibility/source/UAccCOM/AccRelation.cxx
@@ -58,17 +58,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccRelation::get_relationType(BSTR* relationT
 }
 
 // Gets what the type of localized relation is.
-COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccRelation::get_localizedRelationType(BSTR*)
-{
-    try
-    {
-        return S_OK;
-    }
-    catch (...)
-    {
-        return E_FAIL;
-    }
-}
+COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccRelation::get_localizedRelationType(BSTR*) { return S_OK; }
 
 /**
    * Get targets length.
commit 8fd7eed3020841f4094e6d4882a03ad220f16794
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 17:10:55 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:46:26 2024 +0200

    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.wegh...@posteo.de>

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index c806227c28f3..fc678dee7052 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -15100,8 +15100,6 @@ winaccessibility/source/UAccCOM/AccComponent.h
 winaccessibility/source/UAccCOM/AccEditableText.cxx
 winaccessibility/source/UAccCOM/AccEditableText.h
 winaccessibility/source/UAccCOM/AccImage.h
-winaccessibility/source/UAccCOM/AccRelation.cxx
-winaccessibility/source/UAccCOM/AccRelation.h
 winaccessibility/source/UAccCOM/AccTable.cxx
 winaccessibility/source/UAccCOM/AccTable.h
 winaccessibility/source/UAccCOM/AccText.cxx
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: */
diff --git a/winaccessibility/source/UAccCOM/AccRelation.h 
b/winaccessibility/source/UAccCOM/AccRelation.h
index df258f709dbc..50605d86dd70 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.h
+++ b/winaccessibility/source/UAccCOM/AccRelation.h
@@ -19,7 +19,7 @@
 
 #pragma once
 
-#include "Resource.h"       // main symbols
+#include "Resource.h" // main symbols
 
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
@@ -28,19 +28,14 @@
 /**
  * CAccRelation implements IAccessibleRelation interface.
  */
-class ATL_NO_VTABLE CAccRelation :
-            public CComObjectRoot,
-            public CComCoClass<CAccRelation, &CLSID_AccRelation>,
-            public IAccessibleRelation,
-            public CUNOXWrapper
+class ATL_NO_VTABLE CAccRelation : public CComObjectRoot,
+                                   public CComCoClass<CAccRelation, 
&CLSID_AccRelation>,
+                                   public IAccessibleRelation,
+                                   public CUNOXWrapper
 {
 public:
-    CAccRelation()
-    {
-            }
-    virtual ~CAccRelation()
-    {
-            }
+    CAccRelation() {}
+    virtual ~CAccRelation() {}
 
     DECLARE_NO_REGISTRY()
 
@@ -63,19 +58,19 @@ public:
     // IAccessibleRelation
 
     // Gets what the type of relation is.
-    STDMETHOD(get_relationType)(BSTR * relationType) override;
+    STDMETHOD(get_relationType)(BSTR* relationType) override;
 
     // Gets what the type of localized relation is.
-    STDMETHOD(get_localizedRelationType)(BSTR * relationType) override;
+    STDMETHOD(get_localizedRelationType)(BSTR* relationType) override;
 
     // Gets how many targets this relation have.
-    STDMETHOD(get_nTargets)(long * nTargets) override;
+    STDMETHOD(get_nTargets)(long* nTargets) override;
 
     // Gets one accessible relation target.
-    STDMETHOD(get_target)(long targetIndex, IUnknown * * target) override;
+    STDMETHOD(get_target)(long targetIndex, IUnknown** target) override;
 
     // Gets multiple accessible relation targets.
-    STDMETHOD(get_targets)(long maxTargets, IUnknown * * target, long * 
nTargets) override;
+    STDMETHOD(get_targets)(long maxTargets, IUnknown** target, long* nTargets) 
override;
 
     // Override of IUNOXWrapper.
     STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override;
@@ -84,7 +79,6 @@ public:
     static BSTR getRelationTypeBSTR(int type);
 
 private:
-
     css::accessibility::AccessibleRelation relation;
 };
 

Reply via email to