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