Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / unotext.hxx
blob4edca63ba1eaaccfa1f6536359eb6d8c9185f795
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_INC_UNOTEXT_HXX
21 #define INCLUDED_SW_INC_UNOTEXT_HXX
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/text/XText.hpp>
26 #include <com/sun/star/text/XTextCopy.hpp>
27 #include <com/sun/star/text/XTextRangeCompare.hpp>
28 #include <com/sun/star/text/XRelativeTextContentInsert.hpp>
29 #include <com/sun/star/text/XRelativeTextContentRemove.hpp>
30 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
32 #include <unobaseclass.hxx>
34 namespace com { namespace sun { namespace star {
35 namespace text {
36 class XTextContent;
38 } } }
40 class SfxItemPropertySet;
41 class SwDoc;
42 class SwStartNode;
43 class SwPaM;
44 class OTextCursorHelper;
45 class SwXTextRange;
47 class SwXText
48 : public ::com::sun::star::lang::XTypeProvider
49 , public ::com::sun::star::lang::XUnoTunnel
50 , public ::com::sun::star::beans::XPropertySet
51 , public ::com::sun::star::text::XTextAppendAndConvert
52 , public ::com::sun::star::text::XTextCopy
53 , public ::com::sun::star::text::XTextRangeCompare
54 , public ::com::sun::star::text::XRelativeTextContentInsert
55 , public ::com::sun::star::text::XRelativeTextContentRemove
58 private:
60 class Impl;
61 ::sw::UnoImplPtr<Impl> m_pImpl;
63 virtual void PrepareForAttach(
64 ::com::sun::star::uno::Reference<
65 ::com::sun::star::text::XTextRange > & xRange,
66 SwPaM const & rPam);
67 virtual bool CheckForOwnMemberMeta(
68 const SwPaM & rPam, const bool bAbsorb)
69 throw (::com::sun::star::lang::IllegalArgumentException,
70 ::com::sun::star::uno::RuntimeException);
72 protected:
74 bool IsValid() const;
75 void Invalidate();
76 void SetDoc(SwDoc *const pDoc);
78 virtual ~SwXText();
80 public: /*not protected because C++ is retarded*/
81 virtual const SwStartNode *GetStartNode() const;
83 public:
85 SwXText(SwDoc *const pDoc, const enum CursorType eType);
87 const SwDoc* GetDoc() const;
88 SwDoc* GetDoc();
90 virtual ::com::sun::star::uno::Reference<
91 ::com::sun::star::text::XTextCursor >
92 CreateCursor()
93 throw (::com::sun::star::uno::RuntimeException);
95 // XInterface
96 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
97 const ::com::sun::star::uno::Type& rType)
98 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 // XTypeProvider
101 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
102 SAL_CALL getTypes()
103 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
107 // XUnoTunnel
108 virtual sal_Int64 SAL_CALL getSomething(
109 const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
110 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 // XPropertySet
113 virtual ::com::sun::star::uno::Reference<
114 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
115 getPropertySetInfo()
116 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 virtual void SAL_CALL setPropertyValue(
118 const OUString& rPropertyName,
119 const ::com::sun::star::uno::Any& rValue)
120 throw (::com::sun::star::beans::UnknownPropertyException,
121 ::com::sun::star::beans::PropertyVetoException,
122 ::com::sun::star::lang::IllegalArgumentException,
123 ::com::sun::star::lang::WrappedTargetException,
124 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
126 const OUString& rPropertyName)
127 throw (::com::sun::star::beans::UnknownPropertyException,
128 ::com::sun::star::lang::WrappedTargetException,
129 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 virtual void SAL_CALL addPropertyChangeListener(
131 const OUString& rPropertyName,
132 const ::com::sun::star::uno::Reference<
133 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
134 throw (::com::sun::star::beans::UnknownPropertyException,
135 ::com::sun::star::lang::WrappedTargetException,
136 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 virtual void SAL_CALL removePropertyChangeListener(
138 const OUString& rPropertyName,
139 const ::com::sun::star::uno::Reference<
140 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
141 throw (::com::sun::star::beans::UnknownPropertyException,
142 ::com::sun::star::lang::WrappedTargetException,
143 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 virtual void SAL_CALL addVetoableChangeListener(
145 const OUString& rPropertyName,
146 const ::com::sun::star::uno::Reference<
147 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
148 throw (::com::sun::star::beans::UnknownPropertyException,
149 ::com::sun::star::lang::WrappedTargetException,
150 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 virtual void SAL_CALL removeVetoableChangeListener(
152 const OUString& rPropertyName,
153 const ::com::sun::star::uno::Reference<
154 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
155 throw (::com::sun::star::beans::UnknownPropertyException,
156 ::com::sun::star::lang::WrappedTargetException,
157 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 // XTextRange
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
161 SAL_CALL getText()
162 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 virtual ::com::sun::star::uno::Reference<
164 ::com::sun::star::text::XTextRange > SAL_CALL getStart()
165 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 virtual ::com::sun::star::uno::Reference<
167 ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
168 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 virtual OUString SAL_CALL getString()
170 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 virtual void SAL_CALL setString(const OUString& rString)
172 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 // XSimpleText
175 virtual void SAL_CALL insertString(
176 const ::com::sun::star::uno::Reference<
177 ::com::sun::star::text::XTextRange > & xRange,
178 const OUString& aString, sal_Bool bAbsorb)
179 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 virtual void SAL_CALL insertControlCharacter(
181 const ::com::sun::star::uno::Reference<
182 ::com::sun::star::text::XTextRange > & xRange,
183 sal_Int16 nControlCharacter, sal_Bool bAbsorb)
184 throw (::com::sun::star::lang::IllegalArgumentException,
185 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 // XText
188 virtual void SAL_CALL insertTextContent(
189 const ::com::sun::star::uno::Reference<
190 ::com::sun::star::text::XTextRange > & xRange,
191 const ::com::sun::star::uno::Reference<
192 ::com::sun::star::text::XTextContent > & xContent,
193 sal_Bool bAbsorb)
194 throw (::com::sun::star::lang::IllegalArgumentException,
195 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
196 virtual void SAL_CALL removeTextContent(
197 const ::com::sun::star::uno::Reference<
198 ::com::sun::star::text::XTextContent > & xContent)
199 throw (::com::sun::star::container::NoSuchElementException,
200 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 // XParagraphAppend
203 virtual ::com::sun::star::uno::Reference<
204 ::com::sun::star::text::XTextRange > SAL_CALL
205 finishParagraph(
206 const ::com::sun::star::uno::Sequence<
207 ::com::sun::star::beans::PropertyValue >&
208 rCharacterAndParagraphProperties)
209 throw (::com::sun::star::lang::IllegalArgumentException,
210 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
211 virtual ::com::sun::star::uno::Reference<
212 ::com::sun::star::text::XTextRange > SAL_CALL
213 finishParagraphInsert(
214 const ::com::sun::star::uno::Sequence<
215 ::com::sun::star::beans::PropertyValue >&
216 rCharacterAndParagraphProperties,
217 const ::com::sun::star::uno::Reference<
218 ::com::sun::star::text::XTextRange >&
219 xInsertPosition)
220 throw (::com::sun::star::lang::IllegalArgumentException,
221 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
223 // XTextPortionAppend
224 virtual ::com::sun::star::uno::Reference<
225 ::com::sun::star::text::XTextRange > SAL_CALL
226 appendTextPortion(
227 const OUString& rText,
228 const ::com::sun::star::uno::Sequence<
229 ::com::sun::star::beans::PropertyValue >&
230 rCharacterAndParagraphProperties)
231 throw (css::lang::IllegalArgumentException,
232 css::beans::UnknownPropertyException,
233 css::beans::PropertyVetoException,
234 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
236 virtual ::com::sun::star::uno::Reference<
237 ::com::sun::star::text::XTextRange > SAL_CALL
238 insertTextPortion(
239 const OUString& rText,
240 const ::com::sun::star::uno::Sequence<
241 ::com::sun::star::beans::PropertyValue >&
242 rCharacterAndParagraphProperties,
243 const ::com::sun::star::uno::Reference<
244 ::com::sun::star::text::XTextRange >&
245 rTextRange)
246 throw (css::lang::IllegalArgumentException,
247 css::beans::UnknownPropertyException,
248 css::beans::PropertyVetoException,
249 css::uno::RuntimeException,
250 std::exception) SAL_OVERRIDE;
252 // XTextContentAppend
253 virtual ::com::sun::star::uno::Reference<
254 ::com::sun::star::text::XTextRange > SAL_CALL
255 appendTextContent(
256 const ::com::sun::star::uno::Reference<
257 ::com::sun::star::text::XTextContent >& xTextContent,
258 const ::com::sun::star::uno::Sequence<
259 ::com::sun::star::beans::PropertyValue >&
260 rCharacterAndParagraphProperties)
261 throw (::com::sun::star::lang::IllegalArgumentException,
262 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
263 virtual ::com::sun::star::uno::Reference<
264 ::com::sun::star::text::XTextRange > SAL_CALL
265 insertTextContentWithProperties(
266 const ::com::sun::star::uno::Reference<
267 ::com::sun::star::text::XTextContent >& xTextContent,
268 const ::com::sun::star::uno::Sequence<
269 ::com::sun::star::beans::PropertyValue >&
270 rCharacterAndParagraphProperties,
271 const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition)
272 throw (::com::sun::star::lang::IllegalArgumentException,
273 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
275 // XTextConvert
276 virtual ::com::sun::star::uno::Reference<
277 ::com::sun::star::text::XTextContent > SAL_CALL
278 convertToTextFrame(
279 const ::com::sun::star::uno::Reference<
280 ::com::sun::star::text::XTextRange >& xStart,
281 const ::com::sun::star::uno::Reference<
282 ::com::sun::star::text::XTextRange >& xEnd,
283 const ::com::sun::star::uno::Sequence<
284 ::com::sun::star::beans::PropertyValue >& xFrameProperties)
285 throw (css::lang::IllegalArgumentException,
286 css::beans::UnknownPropertyException,
287 css::beans::PropertyVetoException,
288 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
289 virtual ::com::sun::star::uno::Reference<
290 ::com::sun::star::text::XTextTable > SAL_CALL
291 convertToTable(
292 ::com::sun::star::uno::Sequence<
293 ::com::sun::star::uno::Sequence<
294 ::com::sun::star::uno::Sequence<
295 ::com::sun::star::uno::Reference<
296 ::com::sun::star::text::XTextRange > > > > const&
297 rTableRanges,
298 ::com::sun::star::uno::Sequence<
299 ::com::sun::star::uno::Sequence<
300 ::com::sun::star::uno::Sequence<
301 ::com::sun::star::beans::PropertyValue > > > const&
302 rCellProperties,
303 ::com::sun::star::uno::Sequence<
304 ::com::sun::star::uno::Sequence<
305 ::com::sun::star::beans::PropertyValue > > const&
306 rRowProperties,
307 ::com::sun::star::uno::Sequence<
308 ::com::sun::star::beans::PropertyValue > const&
309 rTableProperties)
310 throw (::com::sun::star::lang::IllegalArgumentException,
311 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
313 // XTextCopy
314 virtual void SAL_CALL copyText(
315 const ::com::sun::star::uno::Reference<
316 ::com::sun::star::text::XTextCopy >& xSource )
317 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
319 // XTextRangeCompare
320 sal_Int16 SAL_CALL compareRegionStarts(
321 const ::com::sun::star::uno::Reference<
322 ::com::sun::star::text::XTextRange >& xR1,
323 const ::com::sun::star::uno::Reference<
324 ::com::sun::star::text::XTextRange >& xR2)
325 throw (::com::sun::star::lang::IllegalArgumentException,
326 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
327 sal_Int16 SAL_CALL compareRegionEnds(
328 const ::com::sun::star::uno::Reference<
329 ::com::sun::star::text::XTextRange >& xR1,
330 const ::com::sun::star::uno::Reference<
331 ::com::sun::star::text::XTextRange >& xR2)
332 throw (::com::sun::star::lang::IllegalArgumentException,
333 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
335 // XRelativeTextContentInsert
336 virtual void SAL_CALL insertTextContentBefore(
337 const ::com::sun::star::uno::Reference<
338 ::com::sun::star::text::XTextContent>& xNewContent,
339 const ::com::sun::star::uno::Reference<
340 ::com::sun::star::text::XTextContent>& xSuccessor)
341 throw (::com::sun::star::lang::IllegalArgumentException,
342 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
343 virtual void SAL_CALL insertTextContentAfter(
344 const ::com::sun::star::uno::Reference<
345 ::com::sun::star::text::XTextContent>& xNewContent,
346 const ::com::sun::star::uno::Reference<
347 ::com::sun::star::text::XTextContent>& xPredecessor)
348 throw (::com::sun::star::lang::IllegalArgumentException,
349 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
351 // XRelativeTextContentRemove
352 virtual void SAL_CALL removeTextContentBefore(
353 const ::com::sun::star::uno::Reference<
354 ::com::sun::star::text::XTextContent>& xSuccessor)
355 throw (::com::sun::star::lang::IllegalArgumentException,
356 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
357 virtual void SAL_CALL removeTextContentAfter(
358 const ::com::sun::star::uno::Reference<
359 ::com::sun::star::text::XTextContent>& xPredecessor)
360 throw (::com::sun::star::lang::IllegalArgumentException,
361 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
364 #endif // INCLUDED_SW_INC_UNOTEXT_HXX
366 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */