1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright IBM Corporation 2010.
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org.  If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef __ACCRELATION_H_
30 #define __ACCRELATION_H_
31 
32 #include "resource.h"       // main symbols
33 
34 
35 #include <com/sun/star/uno/reference.hxx>
36 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
37 #include "UNOXWrapper.h"
38 
39 /**
40  * CAccRelation implements IAccessibleRelation interface.
41  */
42 class ATL_NO_VTABLE CAccRelation :
43             public CComObjectRoot,
44             public CComCoClass<CAccRelation, &CLSID_AccRelation>,
45             public IAccessibleRelation,
46             public CUNOXWrapper
47 {
48 public:
49     CAccRelation()
50     {
51             }
52     virtual ~CAccRelation()
53     {
54             }
55 
56     DECLARE_REGISTRY_RESOURCEID(IDR_ACCRELATION)
57 
58     DECLARE_PROTECT_FINAL_CONSTRUCT()
59 
60     BEGIN_COM_MAP(CAccRelation)
61     COM_INTERFACE_ENTRY(IAccessibleRelation)
62     COM_INTERFACE_ENTRY(IUNOXWrapper)
63     END_COM_MAP()
64 
65     // IAccessibleRelation
66 public:
67     // IAccessibleRelation
68 
69     // Gets what the type of relation is.
70     STDMETHOD(get_relationType)(BSTR * relationType);
71 
72     // Gets what the type of localized relation is.
73     STDMETHOD(get_localizedRelationType)(BSTR * relationType);
74 
75     // Gets how many targets this relation have.
76     STDMETHOD(get_nTargets)(long * nTargets);
77 
78     // Gets one accessible relation target.
79     STDMETHOD(get_target)(long targetIndex, IUnknown * * target);
80 
81     // Gets multiple accessible relation targets.
82     STDMETHOD(get_targets)(long maxTargets, IUnknown * * target, long * nTargets);
83 
84     // Overide of IUNOXWrapper.
85     STDMETHOD(put_XSubInterface)(long pXSubInterface);
86 
87     //static OLECHAR* getRelationTypeOLECHAR(int type);
88     static BSTR getRelationTypeBSTR(int type);
89 
90 private:
91 
92     com::sun::star::accessibility::AccessibleRelation relation;
93 };
94 
95 #endif //__ACCRELATION_H_
96