Avoid potential negative array index access to cached text.
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccText.cxx
blob0cddc52a8fc52e7103b2aa5a6ad663d4629c6719
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "stdafx.h"
21 #include <UAccCOM.h>
22 #include "AccText.h"
24 using namespace com::sun::star::accessibility;
25 using namespace com::sun::star::uno;
27 /**
28 * Get special selection.
29 * @param startOffset Start selection offset.
30 * @param endOffset End selection offset.
31 * @param success Variant to accept the result of if the method call is successful.
32 * @return Result.
34 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::addSelection(long startOffset, long endOffset)//, unsigned char * success)
37 return CAccTextBase::get_addSelection(startOffset, endOffset);//, success);
40 /**
41 * Get special attributes.
42 * @param offset Offset.
43 * @param startOffset Variant to accept start offset.
44 * @param endOffset Variant to accept end offset.
45 * @param textAttributes Variant to accept attributes.
46 * @return Result.
48 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
51 return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
54 /**
55 * Get caret position.
56 * @param offset Variant to accept caret offset.
57 * @return Result.
59 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_caretOffset(long * offset)
62 return CAccTextBase::get_caretOffset(offset);
65 /**
66 * Get character extents.
67 * @param offset Offset.
68 * @param x Variant to accept x position.
69 * @param y Variant to accept y position.
70 * @param width Variant to accept width.
71 * @param Height Variant to accept height.
72 * @return Result.
74 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
77 return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
80 /**
81 * Get selections count.
82 * @param nSelections Variant to accept selections count.
83 * @return Result.
85 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_nSelections(long * nSelections)
88 return CAccTextBase::get_nSelections(nSelections);
91 /**
92 * Get offset of some special point.
93 * @param x X position of one point.
94 * @param x Y position of one point.
95 * @param coordType Type.
96 * @param offset Variant to accept offset.
97 * @return Result.
100 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
103 return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset);
107 * Get selection range.
108 * @param selection selection count.
109 * @param startOffset Variant to accept the start offset of special selection.
110 * @param endOffset Variant to accept the end offset of special selection.
111 * @return Result.
113 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_selection(long selection, long * startOffset, long * endOffset)
116 return CAccTextBase::get_selection(selection, startOffset, endOffset);
120 * Get special text.
121 * @param startOffset Start position of special range.
122 * @param endOffset End position of special range.
123 * @param text Variant to accept the text of special range.
124 * @return Result.
126 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_text(long startOffset, long endOffset, BSTR * text)
129 return CAccTextBase::get_text(startOffset, endOffset, text);
133 * Get special text before some position.
134 * @param offset Special position.
135 * @param boundaryType Boundary type.
136 * @param startOffset Variant to accept the start offset.
137 * @param endOffset Variant to accept the end offset.
138 * @param text Variant to accept the special text.
139 * @return Result.
141 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
144 return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
145 startOffset, endOffset, text);
149 * Get special text after some position.
150 * @param offset Special position.
151 * @param boundaryType Boundary type.
152 * @param startOffset Variant to accept the start offset.
153 * @param endOffset Variant to accept the end offset.
154 * @param text Variant to accept the special text.
155 * @return Result.
157 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
160 return CAccTextBase::get_textAfterOffset(offset, boundaryType,
161 startOffset, endOffset, text);
165 * Get special text at some position.
166 * @param offset Special position.
167 * @param boundaryType Boundary type.
168 * @param startOffset Variant to accept the start offset.
169 * @param endOffset Variant to accept the end offset.
170 * @param text Variant to accept the special text.
171 * @return Result.
173 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
176 return CAccTextBase::get_textAtOffset(offset, boundaryType,
177 startOffset, endOffset, text);
181 * Remove selection.
182 * @param selectionIndex Special selection index
183 * @param success Variant to accept the method called result.
184 * @return Result.
186 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::removeSelection(long selectionIndex)//, unsigned char * success)
189 return CAccTextBase::removeSelection(selectionIndex);//, success);
193 * Set caret position.
194 * @param offset Special position.
195 * @param success Variant to accept the method called result.
196 * @return Result.
198 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::setCaretOffset(long offset)
201 return CAccTextBase::setCaretOffset(offset);
205 * Set special selection.
206 * @param selectionIndex Special selection index.
207 * @param startOffset start position.
208 * @param endOffset end position.
209 * @param success Variant to accept the method called result.
210 * @return Result.
213 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::setSelection(long selectionIndex, long startOffset, long endOffset)
216 return CAccTextBase::setSelection(selectionIndex, startOffset,
217 endOffset);
221 * Get characters count.
222 * @param nCharacters Variant to accept the characters count.
223 * @return Result.
225 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_nCharacters(long * nCharacters)
228 return CAccTextBase::get_nCharacters(nCharacters);
231 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_newText( IA2TextSegment *newText)
233 return CAccTextBase::get_newText(newText);
236 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::get_oldText( IA2TextSegment *oldText)
238 return CAccTextBase::get_oldText(oldText);
242 * Scroll to special sub-string .
243 * @param startIndex Start index of sub string.
244 * @param endIndex End index of sub string.
245 * @return Result.
247 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
250 return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
253 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccText::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
256 return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType);
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */