xref: /aoo41x/main/sw/inc/unotext.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SW_UNOTEXT_HXX
29 #define SW_UNOTEXT_HXX
30 
31 #include <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/text/XText.hpp>
34 #include <com/sun/star/text/XTextCopy.hpp>
35 #include <com/sun/star/text/XTextRangeCompare.hpp>
36 #include <com/sun/star/text/XRelativeTextContentInsert.hpp>
37 #include <com/sun/star/text/XRelativeTextContentRemove.hpp>
38 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
39 
40 #include <unobaseclass.hxx>
41 
42 
43 namespace com { namespace sun { namespace star {
44     namespace text {
45         class XTextContent;
46     }
47 } } }
48 
49 class SfxItemPropertySet;
50 class SwDoc;
51 class SwStartNode;
52 class SwPaM;
53 class OTextCursorHelper;
54 class SwXTextRange;
55 
56 
57 /* -----------------03.12.98 12:22-------------------
58  *
59  * --------------------------------------------------*/
60 
61 class SwXText
62     : public ::com::sun::star::lang::XTypeProvider
63     , public ::com::sun::star::lang::XUnoTunnel
64     , public ::com::sun::star::beans::XPropertySet
65     , public ::com::sun::star::text::XTextAppendAndConvert
66     , public ::com::sun::star::text::XTextCopy
67     , public ::com::sun::star::text::XTextRangeCompare
68     , public ::com::sun::star::text::XRelativeTextContentInsert
69     , public ::com::sun::star::text::XRelativeTextContentRemove
70 {
71 
72 private:
73 
74     class Impl;
75     ::sw::UnoImplPtr<Impl> m_pImpl;
76 
77     virtual void PrepareForAttach(
78             ::com::sun::star::uno::Reference<
79                 ::com::sun::star::text::XTextRange > & xRange,
80             SwPaM const & rPam);
81     virtual bool CheckForOwnMemberMeta(
82             const SwPaM & rPam, const bool bAbsorb)
83         throw (::com::sun::star::lang::IllegalArgumentException,
84                ::com::sun::star::uno::RuntimeException);
85 
86 protected:
87 
88     bool            IsValid() const;
89     void            Invalidate();
90     void            SetDoc(SwDoc *const pDoc);
91 
92     virtual ~SwXText();
93 
94 public: /*not protected because C++ is retarded*/
95     virtual const SwStartNode *GetStartNode() const;
96 
97 public:
98 
99     SwXText(SwDoc *const pDoc, const enum CursorType eType);
100 
101     const SwDoc*    GetDoc() const;
102           SwDoc*    GetDoc();
103 
104     virtual ::com::sun::star::uno::Reference<
105                 ::com::sun::star::text::XTextCursor >
106         CreateCursor()
107         throw (::com::sun::star::uno::RuntimeException);
108 
109 
110     // XInterface
111     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
112             const ::com::sun::star::uno::Type& rType)
113         throw (::com::sun::star::uno::RuntimeException);
114 
115     // XTypeProvider
116     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
117         SAL_CALL getTypes()
118         throw (::com::sun::star::uno::RuntimeException);
119 
120     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
121 
122     // XUnoTunnel
123     virtual sal_Int64 SAL_CALL getSomething(
124             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
125         throw (::com::sun::star::uno::RuntimeException);
126 
127     // XPropertySet
128     virtual ::com::sun::star::uno::Reference<
129                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
130         getPropertySetInfo()
131         throw (::com::sun::star::uno::RuntimeException);
132     virtual void SAL_CALL setPropertyValue(
133             const ::rtl::OUString& rPropertyName,
134             const ::com::sun::star::uno::Any& rValue)
135         throw (::com::sun::star::beans::UnknownPropertyException,
136                 ::com::sun::star::beans::PropertyVetoException,
137                 ::com::sun::star::lang::IllegalArgumentException,
138                 ::com::sun::star::lang::WrappedTargetException,
139                 ::com::sun::star::uno::RuntimeException);
140     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
141             const ::rtl::OUString& rPropertyName)
142         throw (::com::sun::star::beans::UnknownPropertyException,
143                 ::com::sun::star::lang::WrappedTargetException,
144                 ::com::sun::star::uno::RuntimeException);
145     virtual void SAL_CALL addPropertyChangeListener(
146             const ::rtl::OUString& rPropertyName,
147             const ::com::sun::star::uno::Reference<
148                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
149         throw (::com::sun::star::beans::UnknownPropertyException,
150                 ::com::sun::star::lang::WrappedTargetException,
151                 ::com::sun::star::uno::RuntimeException);
152     virtual void SAL_CALL removePropertyChangeListener(
153             const ::rtl::OUString& rPropertyName,
154             const ::com::sun::star::uno::Reference<
155                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
156         throw (::com::sun::star::beans::UnknownPropertyException,
157                 ::com::sun::star::lang::WrappedTargetException,
158                 ::com::sun::star::uno::RuntimeException);
159     virtual void SAL_CALL addVetoableChangeListener(
160             const ::rtl::OUString& rPropertyName,
161             const ::com::sun::star::uno::Reference<
162                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
163         throw (::com::sun::star::beans::UnknownPropertyException,
164                 ::com::sun::star::lang::WrappedTargetException,
165                 ::com::sun::star::uno::RuntimeException);
166     virtual void SAL_CALL removeVetoableChangeListener(
167             const ::rtl::OUString& rPropertyName,
168             const ::com::sun::star::uno::Reference<
169                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
170         throw (::com::sun::star::beans::UnknownPropertyException,
171                 ::com::sun::star::lang::WrappedTargetException,
172                 ::com::sun::star::uno::RuntimeException);
173 
174     // XTextRange
175     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
176         SAL_CALL getText()
177         throw (::com::sun::star::uno::RuntimeException);
178     virtual ::com::sun::star::uno::Reference<
179                 ::com::sun::star::text::XTextRange > SAL_CALL getStart()
180         throw (::com::sun::star::uno::RuntimeException);
181     virtual ::com::sun::star::uno::Reference<
182                 ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
183         throw (::com::sun::star::uno::RuntimeException);
184     virtual ::rtl::OUString SAL_CALL getString()
185         throw (::com::sun::star::uno::RuntimeException);
186     virtual void SAL_CALL setString(const ::rtl::OUString& rString)
187         throw (::com::sun::star::uno::RuntimeException);
188 
189     // XSimpleText
190     virtual void SAL_CALL insertString(
191             const ::com::sun::star::uno::Reference<
192                 ::com::sun::star::text::XTextRange > & xRange,
193             const ::rtl::OUString& aString, sal_Bool bAbsorb)
194         throw (::com::sun::star::uno::RuntimeException);
195     virtual void SAL_CALL insertControlCharacter(
196             const ::com::sun::star::uno::Reference<
197                 ::com::sun::star::text::XTextRange > & xRange,
198             sal_Int16 nControlCharacter, sal_Bool bAbsorb)
199         throw (::com::sun::star::lang::IllegalArgumentException,
200                 ::com::sun::star::uno::RuntimeException);
201 
202     // XText
203     virtual void SAL_CALL insertTextContent(
204             const ::com::sun::star::uno::Reference<
205                 ::com::sun::star::text::XTextRange > & xRange,
206             const ::com::sun::star::uno::Reference<
207                 ::com::sun::star::text::XTextContent > & xContent,
208             sal_Bool bAbsorb)
209         throw (::com::sun::star::lang::IllegalArgumentException,
210             ::com::sun::star::uno::RuntimeException);
211     virtual void SAL_CALL removeTextContent(
212             const ::com::sun::star::uno::Reference<
213                 ::com::sun::star::text::XTextContent > & xContent)
214         throw (::com::sun::star::container::NoSuchElementException,
215                 ::com::sun::star::uno::RuntimeException);
216 
217     // XParagraphAppend
218     virtual ::com::sun::star::uno::Reference<
219                 ::com::sun::star::text::XTextRange > SAL_CALL
220         appendParagraph(
221             const ::com::sun::star::uno::Sequence<
222                     ::com::sun::star::beans::PropertyValue >&
223                 rCharacterAndParagraphProperties)
224         throw (::com::sun::star::lang::IllegalArgumentException,
225                 ::com::sun::star::uno::RuntimeException);
226     virtual ::com::sun::star::uno::Reference<
227                 ::com::sun::star::text::XTextRange > SAL_CALL
228         finishParagraph(
229             const ::com::sun::star::uno::Sequence<
230                     ::com::sun::star::beans::PropertyValue >&
231                 rCharacterAndParagraphProperties)
232         throw (::com::sun::star::lang::IllegalArgumentException,
233                 ::com::sun::star::uno::RuntimeException);
234 
235     // XTextPortionAppend
236     virtual ::com::sun::star::uno::Reference<
237                 ::com::sun::star::text::XTextRange > SAL_CALL
238         appendTextPortion(
239             const ::rtl::OUString& rText,
240             const ::com::sun::star::uno::Sequence<
241                     ::com::sun::star::beans::PropertyValue >&
242                 rCharacterAndParagraphProperties)
243         throw (::com::sun::star::lang::IllegalArgumentException,
244                 ::com::sun::star::uno::RuntimeException);
245 
246     // XTextContentAppend
247     virtual ::com::sun::star::uno::Reference<
248                 ::com::sun::star::text::XTextRange > SAL_CALL
249         appendTextContent(
250             const ::com::sun::star::uno::Reference<
251                 ::com::sun::star::text::XTextContent >& xTextContent,
252             const ::com::sun::star::uno::Sequence<
253                     ::com::sun::star::beans::PropertyValue >&
254                 rCharacterAndParagraphProperties)
255         throw (::com::sun::star::lang::IllegalArgumentException,
256                 ::com::sun::star::uno::RuntimeException);
257 
258     // XTextConvert
259     virtual ::com::sun::star::uno::Reference<
260                 ::com::sun::star::text::XTextContent > SAL_CALL
261         convertToTextFrame(
262             const ::com::sun::star::uno::Reference<
263                 ::com::sun::star::text::XTextRange >& xStart,
264             const ::com::sun::star::uno::Reference<
265                 ::com::sun::star::text::XTextRange >& xEnd,
266             const ::com::sun::star::uno::Sequence<
267                 ::com::sun::star::beans::PropertyValue >& xFrameProperties)
268         throw (::com::sun::star::lang::IllegalArgumentException,
269                 ::com::sun::star::uno::RuntimeException);
270     virtual ::com::sun::star::uno::Reference<
271                 ::com::sun::star::text::XTextTable > SAL_CALL
272         convertToTable(
273             ::com::sun::star::uno::Sequence<
274                 ::com::sun::star::uno::Sequence<
275                     ::com::sun::star::uno::Sequence<
276                         ::com::sun::star::uno::Reference<
277                             ::com::sun::star::text::XTextRange > > > > const&
278                 rTableRanges,
279            ::com::sun::star::uno::Sequence<
280                 ::com::sun::star::uno::Sequence<
281                     ::com::sun::star::uno::Sequence<
282                         ::com::sun::star::beans::PropertyValue > > > const&
283                 rCellProperties,
284            ::com::sun::star::uno::Sequence<
285                 ::com::sun::star::uno::Sequence<
286                     ::com::sun::star::beans::PropertyValue > > const&
287                 rRowProperties,
288            ::com::sun::star::uno::Sequence<
289                 ::com::sun::star::beans::PropertyValue > const&
290                 rTableProperties)
291         throw (::com::sun::star::lang::IllegalArgumentException,
292                 ::com::sun::star::uno::RuntimeException);
293 
294     // XTextCopy
295     virtual void SAL_CALL copyText(
296             const ::com::sun::star::uno::Reference<
297                 ::com::sun::star::text::XTextCopy >& xSource )
298         throw (::com::sun::star::uno::RuntimeException);
299 
300     // XTextRangeCompare
301     sal_Int16 SAL_CALL compareRegionStarts(
302             const ::com::sun::star::uno::Reference<
303                 ::com::sun::star::text::XTextRange >& xR1,
304             const ::com::sun::star::uno::Reference<
305                 ::com::sun::star::text::XTextRange >& xR2)
306         throw (::com::sun::star::lang::IllegalArgumentException,
307                 ::com::sun::star::uno::RuntimeException);
308     sal_Int16 SAL_CALL compareRegionEnds(
309             const ::com::sun::star::uno::Reference<
310                 ::com::sun::star::text::XTextRange >& xR1,
311             const ::com::sun::star::uno::Reference<
312                 ::com::sun::star::text::XTextRange >& xR2)
313         throw (::com::sun::star::lang::IllegalArgumentException,
314                 ::com::sun::star::uno::RuntimeException);
315 
316     // XRelativeTextContentInsert
317     virtual void SAL_CALL insertTextContentBefore(
318             const ::com::sun::star::uno::Reference<
319                 ::com::sun::star::text::XTextContent>& xNewContent,
320             const ::com::sun::star::uno::Reference<
321                 ::com::sun::star::text::XTextContent>& xSuccessor)
322         throw (::com::sun::star::lang::IllegalArgumentException,
323                 ::com::sun::star::uno::RuntimeException);
324     virtual void SAL_CALL insertTextContentAfter(
325             const ::com::sun::star::uno::Reference<
326                 ::com::sun::star::text::XTextContent>& xNewContent,
327             const ::com::sun::star::uno::Reference<
328                 ::com::sun::star::text::XTextContent>& xPredecessor)
329         throw (::com::sun::star::lang::IllegalArgumentException,
330                 ::com::sun::star::uno::RuntimeException);
331 
332     // XRelativeTextContentRemove
333     virtual void SAL_CALL removeTextContentBefore(
334             const ::com::sun::star::uno::Reference<
335                 ::com::sun::star::text::XTextContent>& xSuccessor)
336         throw (::com::sun::star::lang::IllegalArgumentException,
337                 ::com::sun::star::uno::RuntimeException);
338     virtual void SAL_CALL removeTextContentAfter(
339             const ::com::sun::star::uno::Reference<
340                 ::com::sun::star::text::XTextContent>& xPredecessor)
341         throw (::com::sun::star::lang::IllegalArgumentException,
342                 ::com::sun::star::uno::RuntimeException);
343 };
344 
345 #endif // SW_UNOTEXT_HXX
346 
347