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