xref: /AOO41X/main/winaccessibility/source/UAccCOM/AccText.h (revision 5fdc4257b5e43545f8f7841d9e8303d3a99b1714)
1*5fdc4257SSteve Yin /*************************************************************************
2*5fdc4257SSteve Yin  *
3*5fdc4257SSteve Yin  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*5fdc4257SSteve Yin  *
5*5fdc4257SSteve Yin  * Copyright IBM Corporation 2010.
6*5fdc4257SSteve Yin  * Copyright 2000, 2010 Oracle and/or its affiliates.
7*5fdc4257SSteve Yin  *
8*5fdc4257SSteve Yin  * OpenOffice.org - a multi-platform office productivity suite
9*5fdc4257SSteve Yin  *
10*5fdc4257SSteve Yin  * This file is part of OpenOffice.org.
11*5fdc4257SSteve Yin  *
12*5fdc4257SSteve Yin  * OpenOffice.org is free software: you can redistribute it and/or modify
13*5fdc4257SSteve Yin  * it under the terms of the GNU Lesser General Public License version 3
14*5fdc4257SSteve Yin  * only, as published by the Free Software Foundation.
15*5fdc4257SSteve Yin  *
16*5fdc4257SSteve Yin  * OpenOffice.org is distributed in the hope that it will be useful,
17*5fdc4257SSteve Yin  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18*5fdc4257SSteve Yin  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19*5fdc4257SSteve Yin  * GNU Lesser General Public License version 3 for more details
20*5fdc4257SSteve Yin  * (a copy is included in the LICENSE file that accompanied this code).
21*5fdc4257SSteve Yin  *
22*5fdc4257SSteve Yin  * You should have received a copy of the GNU Lesser General Public License
23*5fdc4257SSteve Yin  * version 3 along with OpenOffice.org.  If not, see
24*5fdc4257SSteve Yin  * <http://www.openoffice.org/license.html>
25*5fdc4257SSteve Yin  * for a copy of the LGPLv3 License.
26*5fdc4257SSteve Yin  *
27*5fdc4257SSteve Yin  ************************************************************************/
28*5fdc4257SSteve Yin 
29*5fdc4257SSteve Yin #if !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
30*5fdc4257SSteve Yin #define AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_
31*5fdc4257SSteve Yin 
32*5fdc4257SSteve Yin #if _MSC_VER > 1000
33*5fdc4257SSteve Yin #pragma once
34*5fdc4257SSteve Yin #endif // _MSC_VER > 1000
35*5fdc4257SSteve Yin 
36*5fdc4257SSteve Yin #include "resource.h"       // main symbols
37*5fdc4257SSteve Yin 
38*5fdc4257SSteve Yin #include "AccTextBase.h"
39*5fdc4257SSteve Yin 
40*5fdc4257SSteve Yin /**
41*5fdc4257SSteve Yin  * CAccText implements IAccessibleText interface.
42*5fdc4257SSteve Yin  */
43*5fdc4257SSteve Yin class ATL_NO_VTABLE CAccText :
44*5fdc4257SSteve Yin             public CComObjectRoot,
45*5fdc4257SSteve Yin             public CComCoClass<CAccText,&CLSID_AccText>,
46*5fdc4257SSteve Yin             public IAccessibleText,
47*5fdc4257SSteve Yin             public CAccTextBase
48*5fdc4257SSteve Yin {
49*5fdc4257SSteve Yin public:
50*5fdc4257SSteve Yin     CAccText()
51*5fdc4257SSteve Yin     {
52*5fdc4257SSteve Yin             }
53*5fdc4257SSteve Yin     ~CAccText()
54*5fdc4257SSteve Yin     {
55*5fdc4257SSteve Yin             }
56*5fdc4257SSteve Yin 
57*5fdc4257SSteve Yin     BEGIN_COM_MAP(CAccText)
58*5fdc4257SSteve Yin     COM_INTERFACE_ENTRY(IAccessibleText)
59*5fdc4257SSteve Yin     COM_INTERFACE_ENTRY(IUNOXWrapper)
60*5fdc4257SSteve Yin     COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
61*5fdc4257SSteve Yin     END_COM_MAP()
62*5fdc4257SSteve Yin 
63*5fdc4257SSteve Yin     static HRESULT WINAPI _SmartQI(void* pv,
64*5fdc4257SSteve Yin                                    REFIID iid, void** ppvObject, DWORD)
65*5fdc4257SSteve Yin     {
66*5fdc4257SSteve Yin         return ((CAccText*)pv)->SmartQI(iid,ppvObject);
67*5fdc4257SSteve Yin     }
68*5fdc4257SSteve Yin 
69*5fdc4257SSteve Yin     HRESULT SmartQI(REFIID iid, void** ppvObject)
70*5fdc4257SSteve Yin     {
71*5fdc4257SSteve Yin         if( m_pOuterUnknown )
72*5fdc4257SSteve Yin             return OuterQueryInterface(iid,ppvObject);
73*5fdc4257SSteve Yin         return E_FAIL;
74*5fdc4257SSteve Yin     }
75*5fdc4257SSteve Yin 
76*5fdc4257SSteve Yin     DECLARE_REGISTRY_RESOURCEID(IDR_AccText)
77*5fdc4257SSteve Yin 
78*5fdc4257SSteve Yin     // IAccessibleText
79*5fdc4257SSteve Yin public:
80*5fdc4257SSteve Yin     // IAccessibleText
81*5fdc4257SSteve Yin 
82*5fdc4257SSteve Yin     // Adds a text selection.
83*5fdc4257SSteve Yin     STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success);
84*5fdc4257SSteve Yin 
85*5fdc4257SSteve Yin     // Gets text attributes.
86*5fdc4257SSteve Yin     STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
87*5fdc4257SSteve Yin 
88*5fdc4257SSteve Yin     // Gets caret offset.
89*5fdc4257SSteve Yin     STDMETHOD(get_caretOffset)(long * offset);
90*5fdc4257SSteve Yin 
91*5fdc4257SSteve Yin     // Gets total number of characters.
92*5fdc4257SSteve Yin     STDMETHOD(get_characterCount)(long * nCharacters);
93*5fdc4257SSteve Yin 
94*5fdc4257SSteve Yin     // Gets bounding rect containing the glyph(s) representing the character
95*5fdc4257SSteve Yin     // at the specified text offset
96*5fdc4257SSteve Yin     STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
97*5fdc4257SSteve Yin 
98*5fdc4257SSteve Yin     // Gets number of active non-contiguous selections.
99*5fdc4257SSteve Yin     STDMETHOD(get_nSelections)(long * nSelections);
100*5fdc4257SSteve Yin 
101*5fdc4257SSteve Yin     // Gets bounding rect for the glyph at a certain point.
102*5fdc4257SSteve Yin     STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
103*5fdc4257SSteve Yin 
104*5fdc4257SSteve Yin     // Gets character offsets of N-th active text selection.
105*5fdc4257SSteve Yin     STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset);
106*5fdc4257SSteve Yin 
107*5fdc4257SSteve Yin     // Gets a range of text by offset NOTE: returned string may be longer
108*5fdc4257SSteve Yin     // than endOffset-startOffset bytes if text contains multi-byte characters.
109*5fdc4257SSteve Yin     STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
110*5fdc4257SSteve Yin 
111*5fdc4257SSteve Yin     // Gets a specified amount of text that ends before a specified offset.
112*5fdc4257SSteve Yin     STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
113*5fdc4257SSteve Yin 
114*5fdc4257SSteve Yin     // Gets a specified amount of text that spans the specified offset.
115*5fdc4257SSteve Yin     STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
116*5fdc4257SSteve Yin 
117*5fdc4257SSteve Yin     // Gets a specified amount of text that starts after a specified offset.
118*5fdc4257SSteve Yin     STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
119*5fdc4257SSteve Yin 
120*5fdc4257SSteve Yin     // Unselects a range of text.
121*5fdc4257SSteve Yin     STDMETHOD(removeSelection)(long selectionIndex);//, unsigned char * success);
122*5fdc4257SSteve Yin 
123*5fdc4257SSteve Yin     // Moves text caret.
124*5fdc4257SSteve Yin     STDMETHOD(setCaretOffset)(long offset);//, unsigned char * success);
125*5fdc4257SSteve Yin 
126*5fdc4257SSteve Yin     // Changes the bounds of an existing selection.
127*5fdc4257SSteve Yin     STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);//, unsigned char * success);
128*5fdc4257SSteve Yin 
129*5fdc4257SSteve Yin     // Gets total number of characters.
130*5fdc4257SSteve Yin     // NOTE: this may be different than the total number of bytes required
131*5fdc4257SSteve Yin     // to store the text, if the text contains multi-byte characters.
132*5fdc4257SSteve Yin     STDMETHOD(get_nCharacters)(long * nCharacters);
133*5fdc4257SSteve Yin 
134*5fdc4257SSteve Yin     // Makes specific part of string visible on screen.
135*5fdc4257SSteve Yin     STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
136*5fdc4257SSteve Yin     STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
137*5fdc4257SSteve Yin 
138*5fdc4257SSteve Yin     STDMETHOD(get_newText)( IA2TextSegment *newText);
139*5fdc4257SSteve Yin 
140*5fdc4257SSteve Yin     STDMETHOD(get_oldText)( IA2TextSegment *oldText);
141*5fdc4257SSteve Yin 
142*5fdc4257SSteve Yin     // Overide of IUNOXWrapper.
143*5fdc4257SSteve Yin     STDMETHOD(put_XInterface)(long pXInterface);
144*5fdc4257SSteve Yin 
145*5fdc4257SSteve Yin };
146*5fdc4257SSteve Yin 
147*5fdc4257SSteve Yin #endif // !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
148