[Libreoffice-commits] core.git: winaccessibility/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue May 24 21:20:07 UTC 2016


 winaccessibility/source/UAccCOM/AccRelation.cxx |   33 ++++++++++--------------
 1 file changed, 15 insertions(+), 18 deletions(-)

New commits:
commit 44326f8dfabd81bf8b5a5c741f29ae8c57b4a88e
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sat May 21 01:33:49 2016 +0200

    remove unused struct member
    
    TYPE_BSTR_MAP.type was never used, this makes struct obsolete.
    replace magic numbers with constants
    
    Change-Id: Ifbe236c102f78cc570401254dda2fba9bb2c2a95
    Reviewed-on: https://gerrit.libreoffice.org/25228
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/winaccessibility/source/UAccCOM/AccRelation.cxx b/winaccessibility/source/UAccCOM/AccRelation.cxx
index 7d7ab00..6ca355b 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.cxx
+++ b/winaccessibility/source/UAccCOM/AccRelation.cxx
@@ -31,6 +31,7 @@
 
 #include <vcl/svapp.hxx>
 
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/XAccessible.hpp>
 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
 #include "MAccessible.h"
@@ -194,27 +195,23 @@ STDMETHODIMP CAccRelation::put_XSubInterface(hyper pXSubInterface)
 */
 BSTR CAccRelation::getRelationTypeBSTR(int type)
 {
-    static struct TYPE_BSTR_MAP
-    {
-        LPCTSTR string;
-        int type;
-    }
-    map[] =
+    static LPCTSTR map[] =
         {
-            {_T("INVALID")              ,   0},
-            {IA2_RELATION_FLOWS_FROM    ,   1},
-            {IA2_RELATION_FLOWS_TO      ,   2},
-            {IA2_RELATION_CONTROLLED_BY ,   3},
-            {IA2_RELATION_CONTROLLER_FOR,   4},
-            {IA2_RELATION_LABEL_FOR     ,   5},
-            {IA2_RELATION_LABELED_BY    ,   6},
-            {IA2_RELATION_MEMBER_OF     ,   7},
-            {IA2_RELATION_SUBWINDOW_OF  ,   8},
-            {IA2_RELATION_NODE_CHILD_OF ,   9},
-            {IA2_RELATION_DESCRIBED_BY  ,  10},
+            _T("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 >= 0 && type <= 10) ? map[type].string : _T(""));
+    return ::SysAllocString( (type >= AccessibleRelationType::INVALID && type <= AccessibleRelationType::DESCRIBED_BY)
+                             ? map[type] : _T(""));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list