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 #if !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
30 #define AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_
31 
32 #if _MSC_VER > 1000
33 #pragma once
34 #endif // _MSC_VER > 1000
35 
36 #include "resource.h"        // main symbols
37 
38 
39 #include <com/sun/star/uno/reference.hxx>
40 #include <com/sun/star/accessibility/XAccessibleImage.hpp>
41 #include "UNOXWrapper.h"
42 
43 /**
44  * CAccImage implements IAccessibleImage interface.
45  */
46 class ATL_NO_VTABLE CAccImage :
47             public CComObjectRoot,
48             public CComCoClass<CAccImage,&CLSID_AccImage>,
49             public IAccessibleImage,
50             public CUNOXWrapper
51 {
52 public:
53     CAccImage()
54     {
55             }
56     virtual ~CAccImage()
57     {
58             }
59     BEGIN_COM_MAP(CAccImage)
60     COM_INTERFACE_ENTRY(IAccessibleImage)
61     COM_INTERFACE_ENTRY(IUNOXWrapper)
62     COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
63     END_COM_MAP()
64 
65     static HRESULT WINAPI _SmartQI(void* pv,
66                                    REFIID iid, void** ppvObject, DWORD)
67     {
68         return ((CAccImage*)pv)->SmartQI(iid,ppvObject);
69     }
70 
71     HRESULT SmartQI(REFIID iid, void** ppvObject)
72     {
73         if( m_pOuterUnknown )
74             return OuterQueryInterface(iid,ppvObject);
75         return E_FAIL;
76     }
77 
78     DECLARE_REGISTRY_RESOURCEID(IDR_AccImage)
79 
80     // IAccessibleImage
81 public:
82     // IAccessibleImage
83 
84     // Gets the description of the image.
85     STDMETHOD(get_description)(BSTR * description);
86 
87     STDMETHOD(get_imagePosition)( enum IA2CoordinateType coordinateType,
88                                   long __RPC_FAR *x,
89                                   long __RPC_FAR *y);
90 
91     STDMETHOD(get_imageSize)(
92         long __RPC_FAR *height,
93         long __RPC_FAR *width);
94 
95     // Overide of IUNOXWrapper.
96     STDMETHOD(put_XInterface)(long pXInterface);
97 
98 private:
99 
100     com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleImage> pRXImg;
101 
102     inline com::sun::star::accessibility::XAccessibleImage* GetXInterface()
103     {
104         return pRXImg.get();
105     }
106 };
107 
108 #endif // !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
109