Avoid potential negative array index access to cached text.
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccTextBase.h
blob50d50cb077f54eeb9d02766562bc454c721f13eb
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 // AccTextBase.h: interface for the CAccTextBase class.
22 #pragma once
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/accessibility/XAccessibleText.hpp>
26 #include "UNOXWrapper.h"
28 class ATL_NO_VTABLE CAccTextBase : public CUNOXWrapper
30 public:
31 CAccTextBase();
32 virtual ~CAccTextBase();
34 // IAccessibleText
35 public:
36 // IAccessibleText
38 // Adds a text selection.
39 STDMETHOD(get_addSelection)(long startOffset, long endOffset);
41 // Gets text attributes.
42 STDMETHOD(get_attributes)
43 (long offset, long* startOffset, long* endOffset, BSTR* textAttributes);
45 // Gets caret offset.
46 STDMETHOD(get_caretOffset)(long* offset);
48 // Gets total number of characters.
49 STDMETHOD(get_characterCount)(long* nCharacters);
51 // Gets bounding rect containing the glyph(s) representing the character
52 // at the specified text offset
53 STDMETHOD(get_characterExtents)
54 (long offset, IA2CoordinateType coordType, long* x, long* y, long* width, long* height);
56 // Gets number of active non-contiguous selections.
57 STDMETHOD(get_nSelections)(long* nSelections);
59 // Gets bounding rect for the glyph at a certain point.
60 STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long* offset);
62 // Gets character offsets of N-th active text selection.
63 STDMETHOD(get_selection)(long selectionIndex, long* startOffset, long* endOffset);
65 // Gets a range of text by offset NOTE: returned string may be longer
66 // than endOffset-startOffset bytes if text contains multi-byte characters.
67 STDMETHOD(get_text)(long startOffset, long endOffset, BSTR* text);
69 // Gets a specified amount of text that ends before a specified offset.
70 STDMETHOD(get_textBeforeOffset)
71 (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text);
73 // Gets a specified amount of text that spans the specified offset.
74 STDMETHOD(get_textAfterOffset)
75 (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text);
77 // Gets a specified amount of text that starts after a specified offset.
78 STDMETHOD(get_textAtOffset)
79 (long offset, IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text);
81 // Unselects a range of text.
82 STDMETHOD(removeSelection)(long selectionIndex);
84 // Moves text caret.
85 STDMETHOD(setCaretOffset)(long offset);
87 // Changes the bounds of an existing selection.
88 STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);
90 // Gets total number of characters.
91 // NOTE: this may be different than the total number of bytes required
92 // to store the text, if the text contains multi-byte characters.
93 STDMETHOD(get_nCharacters)(long* nCharacters);
95 STDMETHOD(get_newText)(IA2TextSegment* newText);
97 STDMETHOD(get_oldText)(IA2TextSegment* oldText);
99 // Makes specific part of string visible on screen.
100 STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex, enum IA2ScrollType scrollType);
101 STDMETHOD(scrollSubstringToPoint)
102 (long startIndex, long endIndex, enum IA2CoordinateType coordinateType, long x, long y);
104 // Override of IUNOXWrapper.
105 STDMETHOD(put_XInterface)(hyper pXInterface) override;
107 private:
108 css::uno::Reference<css::accessibility::XAccessibleText> pRXText;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */