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_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_) 23 #define AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__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/accessibility/XAccessible.hpp> 33 #include <com/sun/star/accessibility/XAccessibleHypertext.hpp> 34 #include "AccTextBase.h" 35 36 /** 37 * CAccHypertext implements IAccessibleHypertext interface. 38 */ 39 class ATL_NO_VTABLE CAccHypertext : 40 public CComObjectRoot, 41 public CComCoClass<CAccHypertext,&CLSID_AccHypertext>, 42 public IAccessibleHypertext, 43 public CAccTextBase 44 { 45 public: CAccHypertext()46 CAccHypertext() 47 { 48 } ~CAccHypertext()49 ~CAccHypertext() 50 { 51 } 52 53 BEGIN_COM_MAP(CAccHypertext) COM_INTERFACE_ENTRY(IAccessibleText)54 COM_INTERFACE_ENTRY(IAccessibleText) 55 COM_INTERFACE_ENTRY(IAccessibleHypertext) 56 COM_INTERFACE_ENTRY(IUNOXWrapper) 57 COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI) 58 END_COM_MAP() 59 60 static HRESULT WINAPI _SmartQI(void* pv, 61 REFIID iid, void** ppvObject, DWORD) 62 { 63 return ((CAccHypertext*)pv)->SmartQI(iid,ppvObject); 64 } 65 SmartQI(REFIID iid,void ** ppvObject)66 HRESULT SmartQI(REFIID iid, void** ppvObject) 67 { 68 if( m_pOuterUnknown ) 69 return OuterQueryInterface(iid,ppvObject); 70 return E_FAIL; 71 } 72 73 DECLARE_REGISTRY_RESOURCEID(IDR_AccHypertext) 74 75 // IAccessibleHypertext 76 public: 77 // IAccessibleText 78 79 // Adds a text selection. 80 STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success) 81 82 // Gets text attributes. 83 STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes); 84 85 // Gets caret offset. 86 STDMETHOD(get_caretOffset)(long * offset); 87 88 // Gets total number of characters. 89 STDMETHOD(get_characterCount)(long * nCharacters); 90 91 // Gets bounding rect containing the glyph(s) representing the character 92 // at the specified text offset 93 STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height); 94 95 // Gets number of active non-contiguous selections. 96 STDMETHOD(get_nSelections)(long * nSelections); 97 98 // Gets bounding rect for the glyph at a certain point. 99 STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset); 100 101 // Gets character offsets of N-th active text selection. 102 STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset); 103 104 // Gets a range of text by offset NOTE: returned string may be longer 105 // than endOffset-startOffset bytes if text contains multi-byte characters. 106 STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text); 107 108 // Gets a specified amount of text that ends before a specified offset. 109 STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 110 111 // Gets a specified amount of text that spans the specified offset. 112 STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 113 114 // Gets a specified amount of text that starts after a specified offset. 115 STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 116 117 // Unselects a range of text. 118 STDMETHOD(removeSelection)(long selectionIndex); 119 120 // Moves text caret. 121 STDMETHOD(setCaretOffset)(long offset); 122 123 // Changes the bounds of an existing selection. 124 STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset); 125 126 // Gets total number of characters. 127 // NOTE: this may be different than the total number of bytes required 128 // to store the text, if the text contains multi-byte characters. 129 STDMETHOD(get_nCharacters)(long * nCharacters); 130 131 // Makes specific part of string visible on screen. 132 STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType); 133 134 STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y ); 135 136 STDMETHOD(get_newText)( IA2TextSegment *newText); 137 138 STDMETHOD(get_oldText)( IA2TextSegment *oldText); 139 140 //IAccessibleHypertext 141 142 // Gets the number of hyperlink. 143 STDMETHOD(get_nHyperlinks)(long *hyperlinkCount); 144 145 // Gets the hyperlink object via specified index. 146 STDMETHOD(get_hyperlink)(long index,IAccessibleHyperlink **hyperlink); 147 148 // Returns the index of the hyperlink that is associated with this 149 // character index. 150 STDMETHOD(get_hyperlinkIndex)(long charIndex, long *hyperlinkIndex); 151 152 // Overide of IUNOXWrapper. 153 STDMETHOD(put_XInterface)(long pXInterface); 154 155 private: 156 157 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHypertext> pHyperText; 158 159 }; 160 161 #endif // !defined(AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_) 162