1  /**************************************************************
2   *
3   * Licensed to the Apache Software Foundation (ASF) under one
4   * or more contributor license agreements.  See the NOTICE file
5   * distributed with this work for additional information
6   * regarding copyright ownership.  The ASF licenses this file
7   * to you under the Apache License, Version 2.0 (the
8   * "License"); you may not use this file except in compliance
9   * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   *
20   *************************************************************/
21  
22  #if !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
23  #define AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_
24  
25  #if _MSC_VER > 1000
26  #pragma once
27  #endif // _MSC_VER > 1000
28  
29  #include "resource.h"       // main symbols
30  
31  #include <com/sun/star/accessibility/XAccessible.hpp>
32  #include <com/sun/star/accessibility/XAccessibleContext.hpp>
33  #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
34  #include "UNOXWrapper.h"
35  #include "AccComponentBase.h"
36  
37  using namespace com::sun::star::accessibility;
38  using namespace com::sun::star::uno;
39  
40  /**
41   * CAccComponent implements IAccessibleComponent interface.
42   */
43  class ATL_NO_VTABLE CAccComponent :
44              public CComObjectRoot,
45              public CComCoClass<CAccComponent,&CLSID_AccComponent>,
46              public IAccessibleComponent,
47              public CAccComponentBase
48  {
49  public:
CAccComponent()50      CAccComponent()
51      {
52              }
~CAccComponent()53      ~CAccComponent()
54      {
55              }
56  
57      BEGIN_COM_MAP(CAccComponent)
COM_INTERFACE_ENTRY(IAccessibleComponent)58      COM_INTERFACE_ENTRY(IAccessibleComponent)
59      COM_INTERFACE_ENTRY(IUNOXWrapper)
60      COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
61      END_COM_MAP()
62  
63      static HRESULT WINAPI _SmartQI(void* pv,
64                                     REFIID iid, void** ppvObject, DWORD)
65      {
66          return ((CAccComponent*)pv)->SmartQI(iid,ppvObject);
67      }
68  
SmartQI(REFIID iid,void ** ppvObject)69      HRESULT SmartQI(REFIID iid, void** ppvObject)
70      {
71          if( m_pOuterUnknown )
72              return OuterQueryInterface(iid,ppvObject);
73          return E_FAIL;
74      }
75  
76      DECLARE_REGISTRY_RESOURCEID(IDR_AccComponent)
77  
78      // IAccessibleComponent
79  public:
80      // IAccessibleComponent
81  
82      // Returns the location of the upper left corner of the object's bounding
83      // box relative to the parent.
84      STDMETHOD(get_locationInParent)(long *x, long *y);
85  
86      // Returns the foreground color of this object.
87      STDMETHOD(get_foreground)(IA2Color * foreground);
88  
89      // Returns the background color of this object.
90      STDMETHOD(get_background)(IA2Color * background);
91  
92      // Overide of IUNOXWrapper.
93      STDMETHOD(put_XInterface)(long pXInterface);
94  
95  };
96  
97  #endif // !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
98