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