xref: /AOO41X/main/offapi/com/sun/star/text/XSimpleText.idl (revision d1766043198e81d0bcfc626e12893e7b4d7e31ca)
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#ifndef __com_sun_star_text_XSimpleText_idl__
24#define __com_sun_star_text_XSimplText_idl__
25
26#ifndef __com_sun_star_text_XTextRange_idl__
27#include <com/sun/star/text/XTextRange.idl>
28#endif
29
30#ifndef __com_sun_star_text_XTextCursor_idl__
31#include <com/sun/star/text/XTextCursor.idl>
32#endif
33
34#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35#include <com/sun/star/lang/IllegalArgumentException.idl>
36#endif
37
38#ifndef __com_sun_star_text_XTextContent_idl__
39#include <com/sun/star/text/XTextContent.idl>
40#endif
41
42#ifndef __com_sun_star_container_NoSuchElementException_idl__
43#include <com/sun/star/container/NoSuchElementException.idl>
44#endif
45
46
47//=============================================================================
48
49 module com {  module sun {  module star {  module text {
50
51//=============================================================================
52
53/** is the main interface for a distinct text unit, i.e. the main text of
54    a document, the text for headers and footers or for single cells of a
55    table.@see XText
56 */
57published interface XSimpleText: com::sun::star::text::XTextRange
58{
59    //-------------------------------------------------------------------------
60
61    /** @returns
62                a new instance of a <type>TextCursor</type> service which can
63                be used to travel in the given text context.
64
65                @see com::sun::star::text::TextCursor
66     */
67    com::sun::star::text::XTextCursor createTextCursor();
68
69    //-------------------------------------------------------------------------
70
71    /** @returns
72                a new instance of a <type>TextCursor</type> which is located
73                at the specified <type>TextRange</type> to travel in the
74                given text context.
75
76                <p>The initial position is set to <var>aTextPosition</var>.
77
78                @param aTextPosition
79                specifies the start position for the new
80                <type>TextCursor</type>.
81
82                @see com::sun::star::text::TextCursor
83     */
84    com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition );
85
86    //-------------------------------------------------------------------------
87
88    /** inserts a string of characters into the text.
89
90        <p>The string may contain the following white spaces:
91        </p>
92        <ul>
93            <li>blank</li>
94            <li>tab</li>
95            <li>cr (which will insert a paragraph break)</li>
96            <li>lf (which will insert a line break)</li>
97        </ul>
98
99        @param xRange
100            specifies the position of insertion. For example,
101            <method>XSimpleText::createTextCursor</member> can be used to
102            get an <type>XTextRange</type> for this argument.
103
104            <p>If the parameter <member>bAbsorb</member> was <TRUE/>
105            the text range will contain the new inserted string, otherwise
106            the range (and it's text) will remain unchanged.
107
108        @param aString
109            specifies the string to insert.
110
111        @param bAbsorb
112            specifies whether the text spanned by <var>xRange</var> will be
113            replaced. If <TRUE/> then the content of <var>xRange</var> will
114            be replaced by <var>aString</var>, otherwise <var>aString</var>
115            will be inserted at the beginning of <var>xRange</var>.
116
117        @example
118            <listing>
119            xText.insertString( xTextCursor, "Hello " + aName$ + ",", false )
120
121            xText.insertControlCharacter( xTextCursor,
122            ControlCharacter_PARAGRAPH_BREAK, false );
123
124            xText.insertString( xTextCursor, "more text ...", false )
125            </listing>
126     */
127    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange,
128             [in] string aString,
129             [in] boolean bAbsorb );
130
131    //-------------------------------------------------------------------------
132
133    /** inserts a control character (like a paragraph break or a hard
134        space) into the text.@see com::sun::star::text::ControlCharacter
135     */
136    void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange,
137             [in] short nControlCharacter,
138             [in] boolean bAbsorb )
139            raises( com::sun::star::lang::IllegalArgumentException );
140
141};
142
143//=============================================================================
144
145}; }; }; };
146
147#endif
148