Avoid potential negative array index access to cached text.
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccRelation.h
blobdf258f709dbc0976d24529573b2af9a05d878686
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include "Resource.h" // main symbols
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
26 #include "UNOXWrapper.h"
28 /**
29 * CAccRelation implements IAccessibleRelation interface.
31 class ATL_NO_VTABLE CAccRelation :
32 public CComObjectRoot,
33 public CComCoClass<CAccRelation, &CLSID_AccRelation>,
34 public IAccessibleRelation,
35 public CUNOXWrapper
37 public:
38 CAccRelation()
41 virtual ~CAccRelation()
45 DECLARE_NO_REGISTRY()
47 DECLARE_PROTECT_FINAL_CONSTRUCT()
49 BEGIN_COM_MAP(CAccRelation)
50 COM_INTERFACE_ENTRY(IAccessibleRelation)
51 COM_INTERFACE_ENTRY(IUNOXWrapper)
52 #if defined __clang__
53 #pragma clang diagnostic push
54 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
55 #endif
56 END_COM_MAP()
57 #if defined __clang__
58 #pragma clang diagnostic pop
59 #endif
61 // IAccessibleRelation
62 public:
63 // IAccessibleRelation
65 // Gets what the type of relation is.
66 STDMETHOD(get_relationType)(BSTR * relationType) override;
68 // Gets what the type of localized relation is.
69 STDMETHOD(get_localizedRelationType)(BSTR * relationType) override;
71 // Gets how many targets this relation have.
72 STDMETHOD(get_nTargets)(long * nTargets) override;
74 // Gets one accessible relation target.
75 STDMETHOD(get_target)(long targetIndex, IUnknown * * target) override;
77 // Gets multiple accessible relation targets.
78 STDMETHOD(get_targets)(long maxTargets, IUnknown * * target, long * nTargets) override;
80 // Override of IUNOXWrapper.
81 STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override;
83 //static OLECHAR* getRelationTypeOLECHAR(int type);
84 static BSTR getRelationTypeBSTR(int type);
86 private:
88 css::accessibility::AccessibleRelation relation;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */