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
23
24#ifndef __com_sun_star_accessibility_XAccessibleMultiLineText_idl__
25#define __com_sun_star_accessibility_XAccessibleMultiLineText_idl__
26
27#ifndef __com_sun_star_accessibility_XAccessibleText_idl__
28#include <com/sun/star/accessibility/XAccessibleText.idl>
29#endif
30#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
31#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
32#endif
33#ifndef __com_sun_star_beans_PropertyValue_idl__
34#include <com/sun/star/beans/PropertyValue.idl>
35#endif
36
37module com { module sun { module star { module accessibility {
38
39/** Implement this interface to give provide a mapping between text index
40    and line numbers.
41
42    <p>This interface is typically used in conjunction with the
43    <type>XAccessibleText</type> interface and extents it with a notion
44    of line numbers</p>
45
46    @since OOo 3.0
47*/
48
49/// not yet published
50interface XAccessibleMultiLineText
51    : ::com::sun::star::accessibility::XAccessibleText
52{
53    /** Returns the line number at the specified index.
54
55        <p>For a text object that is spread over multiple lines, this method
56        provides a mapping from a text index to the corresponding line number.
57        </p>
58
59        @param nIndex
60            Index for which the line number should be returned.
61            The valid range is 0..length.
62
63        @return
64            Returns the line number of the specified text index.
65
66        @throws ::com::sun::star::lang::IndexOutOfBoundsException
67            if the index is invalid.
68    */
69    long getLineNumberAtIndex([in] long nIndex)
70        raises (::com::sun::star::lang::IndexOutOfBoundsException);
71
72    /** Retuns the text of the specified line.
73
74        <p>Returns the substring of text that makes up the specified line
75        number.</p>
76
77        <p>The number of lines can be obtained by calling
78        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member>
79        with the index of the last character. In a loop, the last line
80        has been reached when <member>TextSegment::SegmentEnd</member>
81        of the returned value is equal to the index of the last
82        character of the text.</p>
83
84        @param nLineNo
85            The number of the line to return the substring from.
86            The valid range is 0..getLineNumberAtIndex(getCharacterCount()).
87
88        @return
89            Returns the requested text portion.  This portion may be empty
90            or invalid when no appropriate text portion is found.
91
92        @throws ::com::sun::star::lang::IndexOutOfBoundsException
93            if the line number is invalid
94    */
95
96    TextSegment getTextAtLineNumber([in] long nLineNo)
97        raises (::com::sun::star::lang::IndexOutOfBoundsException);
98
99    /** Returns the text of the line in which the caret is located.
100
101        <p>The substring returned will most of the time be identical to
102        calling <member>XAccessibleText::getTextAtIndex</member> with
103        the index returned by <member>XAccessibleText::getCaretPosition</member>
104        and type  <const scope="AccessibleTextType">LINE</type> beside the
105        following special case:</p>
106
107        <p>Some text implementations place the caret at the end of the current
108        line when the <b>End</b> key gets pressed. Since the index of this position
109        is identical to the one of the first character of the following line,
110        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member> will
111        return the line following the current one in this case.</p>
112
113        @return
114            Returns the requested text portion. This portion may be empty
115            or invalid if the paragraph object does not have a valid caret
116            position.
117    */
118
119    TextSegment getTextAtLineWithCaret();
120
121    /** Returns the number of the line in which the caret is located.
122
123        <p>The line number returned will most of the time be identical to
124        calling <member>XAccessibleMultiLineText::getLineNumberAtIndex</member>
125        with the index returned by <member>XAccessibleText::getCaretPosition</member>
126        beside the following special case:</p>
127
128        <p>Some text implementations place the caret at the end of the current
129        line when the <b>End</b> key gets pressed. Since the index of this position
130        is identical to the one of the first character of the following line,
131        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member> will
132        return the line following the current one in this case.</p>
133
134        @return
135            Returns the index of the line in which the caret is located or -1
136            if the paragraph does not have a valid caret position.
137    */
138
139    long getNumberOfLineWithCaret();
140};
141
142}; }; }; };
143
144#endif
145