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 // AccTextBase.h: interface for the CAccTextBase class. 30 // 31 ////////////////////////////////////////////////////////////////////// 32 33 #if !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_) 34 #define AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_ 35 36 #if _MSC_VER > 1000 37 #pragma once 38 #endif // _MSC_VER > 1000 39 40 #define WNT 41 42 #include <com/sun/star/uno/reference.hxx> 43 #include <com/sun/star/accessibility/XAccessibleText.hpp> 44 #include "UNOXWrapper.h" 45 46 class ATL_NO_VTABLE CAccTextBase : public CUNOXWrapper 47 { 48 public: 49 CAccTextBase(); 50 virtual ~CAccTextBase(); 51 52 // IAccessibleText 53 public: 54 // IAccessibleText 55 56 // Adds a text selection. 57 STDMETHOD(get_addSelection)(long startOffset, long endOffset); 58 59 // Gets text attributes. 60 STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes); 61 62 // Gets caret offset. 63 STDMETHOD(get_caretOffset)(long * offset); 64 65 // Gets total number of characters. 66 STDMETHOD(get_characterCount)(long * nCharacters); 67 68 // Gets bounding rect containing the glyph(s) representing the character 69 // at the specified text offset 70 STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height); 71 72 // Gets number of active non-contiguous selections. 73 STDMETHOD(get_nSelections)(long * nSelections); 74 75 // Gets bounding rect for the glyph at a certain point. 76 STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset); 77 78 // Gets character offsets of N-th active text selection. 79 STDMETHOD(get_selection)(long selectionIndex, long * startOffset, long * endOffset); 80 81 // Gets a range of text by offset NOTE: returned string may be longer 82 // than endOffset-startOffset bytes if text contains multi-byte characters. 83 STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text); 84 85 // Gets a specified amount of text that ends before a specified offset. 86 STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 87 88 // Gets a specified amount of text that spans the specified offset. 89 STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 90 91 // Gets a specified amount of text that starts after a specified offset. 92 STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text); 93 94 // Unselects a range of text. 95 STDMETHOD(removeSelection)(long selectionIndex); 96 97 // Moves text caret. 98 STDMETHOD(setCaretOffset)(long offset); 99 100 // Changes the bounds of an existing selection. 101 STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset); 102 103 // Gets total number of characters. 104 // NOTE: this may be different than the total number of bytes required 105 // to store the text, if the text contains multi-byte characters. 106 STDMETHOD(get_nCharacters)(long * nCharacters); 107 108 STDMETHOD(get_newText)( IA2TextSegment *newText); 109 110 STDMETHOD(get_oldText)( IA2TextSegment *oldText); 111 112 // Makes specific part of string visible on screen. 113 STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType); 114 STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y ); 115 116 // Overide of IUNOXWrapper. 117 STDMETHOD(put_XInterface)(long pXInterface); 118 119 private: 120 121 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleText> pRXText; 122 123 inline com::sun::star::accessibility::XAccessibleText* GetXInterface() 124 { 125 return pRXText.get(); 126 } 127 }; 128 129 #endif // !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_) 130