1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_accessibility_XAccessibleMultiLineText_idl__
25cdf0e10cSrcweir#define __com_sun_star_accessibility_XAccessibleMultiLineText_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_accessibility_XAccessibleText_idl__
28cdf0e10cSrcweir#include <com/sun/star/accessibility/XAccessibleText.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
31cdf0e10cSrcweir#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__
34cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
35cdf0e10cSrcweir#endif
36cdf0e10cSrcweir
37cdf0e10cSrcweirmodule com { module sun { module star { module accessibility {
38cdf0e10cSrcweir
39cdf0e10cSrcweir/** Implement this interface to give provide a mapping between text index
40cdf0e10cSrcweir    and line numbers.
41cdf0e10cSrcweir
42cdf0e10cSrcweir    <p>This interface is typically used in conjunction with the
43cdf0e10cSrcweir    <type>XAccessibleText</type> interface and extents it with a notion
44cdf0e10cSrcweir    of line numbers</p>
45cdf0e10cSrcweir
46*0d3a54ffSJürgen Schmidt    @since OpenOffice 3.0
47cdf0e10cSrcweir*/
48cdf0e10cSrcweir
49cdf0e10cSrcweir/// not yet published
50cdf0e10cSrcweirinterface XAccessibleMultiLineText
51cdf0e10cSrcweir    : ::com::sun::star::accessibility::XAccessibleText
52cdf0e10cSrcweir{
53cdf0e10cSrcweir    /** Returns the line number at the specified index.
54cdf0e10cSrcweir
55cdf0e10cSrcweir        <p>For a text object that is spread over multiple lines, this method
56cdf0e10cSrcweir        provides a mapping from a text index to the corresponding line number.
57cdf0e10cSrcweir        </p>
58cdf0e10cSrcweir
59cdf0e10cSrcweir        @param nIndex
60cdf0e10cSrcweir            Index for which the line number should be returned.
61cdf0e10cSrcweir            The valid range is 0..length.
62cdf0e10cSrcweir
63cdf0e10cSrcweir        @return
64cdf0e10cSrcweir            Returns the line number of the specified text index.
65cdf0e10cSrcweir
66cdf0e10cSrcweir        @throws ::com::sun::star::lang::IndexOutOfBoundsException
67cdf0e10cSrcweir            if the index is invalid.
68cdf0e10cSrcweir    */
69cdf0e10cSrcweir    long getLineNumberAtIndex([in] long nIndex)
70cdf0e10cSrcweir        raises (::com::sun::star::lang::IndexOutOfBoundsException);
71cdf0e10cSrcweir
72cdf0e10cSrcweir    /** Retuns the text of the specified line.
73cdf0e10cSrcweir
74cdf0e10cSrcweir        <p>Returns the substring of text that makes up the specified line
75cdf0e10cSrcweir        number.</p>
76cdf0e10cSrcweir
77cdf0e10cSrcweir        <p>The number of lines can be obtained by calling
78cdf0e10cSrcweir        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member>
79cdf0e10cSrcweir        with the index of the last character. In a loop, the last line
80cdf0e10cSrcweir        has been reached when <member>TextSegment::SegmentEnd</member>
81cdf0e10cSrcweir        of the returned value is equal to the index of the last
82cdf0e10cSrcweir        character of the text.</p>
83cdf0e10cSrcweir
84cdf0e10cSrcweir        @param nLineNo
85cdf0e10cSrcweir            The number of the line to return the substring from.
86cdf0e10cSrcweir            The valid range is 0..getLineNumberAtIndex(getCharacterCount()).
87cdf0e10cSrcweir
88cdf0e10cSrcweir        @return
89cdf0e10cSrcweir            Returns the requested text portion.  This portion may be empty
90cdf0e10cSrcweir            or invalid when no appropriate text portion is found.
91cdf0e10cSrcweir
92cdf0e10cSrcweir        @throws ::com::sun::star::lang::IndexOutOfBoundsException
93cdf0e10cSrcweir            if the line number is invalid
94cdf0e10cSrcweir    */
95cdf0e10cSrcweir
96cdf0e10cSrcweir    TextSegment getTextAtLineNumber([in] long nLineNo)
97cdf0e10cSrcweir        raises (::com::sun::star::lang::IndexOutOfBoundsException);
98cdf0e10cSrcweir
99cdf0e10cSrcweir    /** Returns the text of the line in which the caret is located.
100cdf0e10cSrcweir
101cdf0e10cSrcweir        <p>The substring returned will most of the time be identical to
102cdf0e10cSrcweir        calling <member>XAccessibleText::getTextAtIndex</member> with
103cdf0e10cSrcweir        the index returned by <member>XAccessibleText::getCaretPosition</member>
104cdf0e10cSrcweir        and type  <const scope="AccessibleTextType">LINE</type> beside the
105cdf0e10cSrcweir        following special case:</p>
106cdf0e10cSrcweir
107cdf0e10cSrcweir        <p>Some text implementations place the caret at the end of the current
108cdf0e10cSrcweir        line when the <b>End</b> key gets pressed. Since the index of this position
109cdf0e10cSrcweir        is identical to the one of the first character of the following line,
110cdf0e10cSrcweir        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member> will
111cdf0e10cSrcweir        return the line following the current one in this case.</p>
112cdf0e10cSrcweir
113cdf0e10cSrcweir        @return
114cdf0e10cSrcweir            Returns the requested text portion. This portion may be empty
115cdf0e10cSrcweir            or invalid if the paragraph object does not have a valid caret
116cdf0e10cSrcweir            position.
117cdf0e10cSrcweir    */
118cdf0e10cSrcweir
119cdf0e10cSrcweir    TextSegment getTextAtLineWithCaret();
120cdf0e10cSrcweir
121cdf0e10cSrcweir    /** Returns the number of the line in which the caret is located.
122cdf0e10cSrcweir
123cdf0e10cSrcweir        <p>The line number returned will most of the time be identical to
124cdf0e10cSrcweir        calling <member>XAccessibleMultiLineText::getLineNumberAtIndex</member>
125cdf0e10cSrcweir        with the index returned by <member>XAccessibleText::getCaretPosition</member>
126cdf0e10cSrcweir        beside the following special case:</p>
127cdf0e10cSrcweir
128cdf0e10cSrcweir        <p>Some text implementations place the caret at the end of the current
129cdf0e10cSrcweir        line when the <b>End</b> key gets pressed. Since the index of this position
130cdf0e10cSrcweir        is identical to the one of the first character of the following line,
131cdf0e10cSrcweir        <member>XAccessibleMultiLineText::getLineNumberAtIndex</member> will
132cdf0e10cSrcweir        return the line following the current one in this case.</p>
133cdf0e10cSrcweir
134cdf0e10cSrcweir        @return
135cdf0e10cSrcweir            Returns the index of the line in which the caret is located or -1
136cdf0e10cSrcweir            if the paragraph does not have a valid caret position.
137cdf0e10cSrcweir    */
138cdf0e10cSrcweir
139cdf0e10cSrcweir    long getNumberOfLineWithCaret();
140cdf0e10cSrcweir};
141cdf0e10cSrcweir
142cdf0e10cSrcweir}; }; }; };
143cdf0e10cSrcweir
144cdf0e10cSrcweir#endif
145