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_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_) 30 #define AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__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/accessibility/XAccessibleHyperlink.hpp> 40 #include "AccActionBase.h" 41 #include "UNOXWrapper.h" 42 43 /** 44 * CAccHyperLink implements IAccessibleHyperlink interface. 45 */ 46 class ATL_NO_VTABLE CAccHyperLink : 47 public CComObjectRoot, 48 public CComCoClass<CAccHyperLink,&CLSID_AccHyperLink>, 49 public IAccessibleHyperlink, 50 public CAccActionBase 51 { 52 public: 53 CAccHyperLink() 54 { 55 } 56 ~CAccHyperLink() 57 { 58 } 59 60 BEGIN_COM_MAP(CAccHyperLink) 61 COM_INTERFACE_ENTRY(IAccessibleAction) 62 COM_INTERFACE_ENTRY(IAccessibleHyperlink) 63 COM_INTERFACE_ENTRY(IUNOXWrapper) 64 END_COM_MAP() 65 66 DECLARE_REGISTRY_RESOURCEID(IDR_AccHyperLink) 67 68 static HRESULT WINAPI _SmartQI(void* pv, 69 REFIID iid, void** ppvObject, DWORD) 70 { 71 return ((CAccHyperLink*)pv)->SmartQI(iid,ppvObject); 72 } 73 74 HRESULT SmartQI(REFIID iid, void** ppvObject) 75 { 76 if( m_pOuterUnknown ) 77 return OuterQueryInterface(iid,ppvObject); 78 return E_FAIL; 79 } 80 81 // IAccessibleHyperlink 82 public: 83 // IAccessibleAction 84 85 // Returns the number of action. 86 STDMETHOD(nActions)(/*[out,retval]*/long* nActions); 87 88 // Performs specified action on the object. 89 STDMETHOD(doAction)(/* [in] */ long actionIndex); 90 91 // get the action name 92 STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name); 93 94 // get the localized action name 95 STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName); 96 97 // Gets description of specified action. 98 STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description); 99 100 // Returns key binding object (if any) associated with specified action 101 // key binding is string. 102 // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut). 103 STDMETHOD(get_keyBinding)( 104 /* [in] */ long actionIndex, 105 /* [in] */ long nMaxBinding, 106 /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding, 107 /* [retval][out] */ long __RPC_FAR *nBinding); 108 109 // IAccessibleHyperlink 110 111 // get an object, e.g. BSTR or image object, that is overloaded with link behavior 112 STDMETHOD(get_anchor)(/* [in] */ long index, 113 /* [retval][out] */ VARIANT __RPC_FAR *anchor); 114 115 // get an object representing the target of the link, usually a BSTR of the URI 116 STDMETHOD(get_anchorTarget)(/* [in] */ long index, 117 /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget); 118 119 // Returns the index at which the textual representation of the 120 // hyperlink (group) starts. 121 STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR *index); 122 123 // Returns the index at which the textual rerpesentation of the 124 // hyperlink (group) ends. 125 STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR *index); 126 127 // Returns whether the document referenced by this links is still valid. 128 STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR *valid); 129 130 // Overide of IUNOXWrapper. 131 STDMETHOD(put_XInterface)(long pXInterface); 132 133 // Overide of IUNOXWrapper. 134 STDMETHOD(put_XSubInterface)(long pXSubInterface); 135 136 private: 137 138 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHyperlink> pRXLink; 139 140 inline com::sun::star::accessibility::XAccessibleHyperlink* GetXInterface() 141 { 142 return pRXLink.get(); 143 } 144 145 }; 146 147 #endif // !defined(AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_) 148