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_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_) 30 #define AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_ 31 32 #if _MSC_VER > 1000 33 #pragma once 34 #endif // _MSC_VER > 1000 35 36 #include "resource.h" // main symbols 37 38 #include "AccTextBase.h" 39 40 /** 41 * CAccText implements IAccessibleText interface. 42 */ 43 class ATL_NO_VTABLE CAccText : 44 public CComObjectRoot, 45 public CComCoClass<CAccText,&CLSID_AccText>, 46 public IAccessibleText, 47 public CAccTextBase 48 { 49 public: 50 CAccText() 51 { 52 } 53 ~CAccText() 54 { 55 } 56 57 BEGIN_COM_MAP(CAccText) 58 COM_INTERFACE_ENTRY(IAccessibleText) 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 ((CAccText*)pv)->SmartQI(iid,ppvObject); 67 } 68 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_AccText) 77 78 // IAccessibleText 79 public: 80 // IAccessibleText 81 82 // Adds a text selection. 83 STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success); 84 85 // Gets text attributes. 86 STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes); 87 88 // Gets caret offset. 89 STDMETHOD(get_caretOffset)(long * offset); 90 91 // Gets total number of characters. 92 STDMETHOD(get_characterCount)(long * nCharacters); 93 94 // Gets bounding rect containing the glyph(s) representing the character 95 // at the specified text offset 96 STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height); 97 98 // Gets number of active non-contiguous selections. 99 STDMETHOD(get_nSelections)(long * nSelections); 100 101 // Gets bounding rect for the glyph at a certain point. 102 STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset); 103 104 // Gets character offsets of N-th active text selection. 105 STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset); 106 107 // Gets a range of text by offset NOTE: returned string may be longer 108 // than endOffset-startOffset bytes if text contains multi-byte characters. 109 STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text); 110 111 // Gets a specified amount of text that ends before a specified offset. 112 STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 113 114 // Gets a specified amount of text that spans the specified offset. 115 STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 116 117 // Gets a specified amount of text that starts after a specified offset. 118 STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 119 120 // Unselects a range of text. 121 STDMETHOD(removeSelection)(long selectionIndex);//, unsigned char * success); 122 123 // Moves text caret. 124 STDMETHOD(setCaretOffset)(long offset);//, unsigned char * success); 125 126 // Changes the bounds of an existing selection. 127 STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);//, unsigned char * success); 128 129 // Gets total number of characters. 130 // NOTE: this may be different than the total number of bytes required 131 // to store the text, if the text contains multi-byte characters. 132 STDMETHOD(get_nCharacters)(long * nCharacters); 133 134 // Makes specific part of string visible on screen. 135 STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType); 136 STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y ); 137 138 STDMETHOD(get_newText)( IA2TextSegment *newText); 139 140 STDMETHOD(get_oldText)( IA2TextSegment *oldText); 141 142 // Overide of IUNOXWrapper. 143 STDMETHOD(put_XInterface)(long pXInterface); 144 145 }; 146 147 #endif // !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_) 148