1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_UNOTEXTCURSOR_HXX
21 #define INCLUDED_SW_INC_UNOTEXTCURSOR_HXX
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/beans/XPropertyState.hpp>
27 #include <com/sun/star/beans/XMultiPropertySet.hpp>
28 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
29 #include <com/sun/star/container/XEnumerationAccess.hpp>
30 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
31 #include <com/sun/star/util/XSortable.hpp>
32 #include <com/sun/star/document/XDocumentInsertable.hpp>
33 #include <com/sun/star/text/XSentenceCursor.hpp>
34 #include <com/sun/star/text/XWordCursor.hpp>
35 #include <com/sun/star/text/XParagraphCursor.hpp>
36 #include <com/sun/star/text/XRedline.hpp>
37 #include <com/sun/star/text/XMarkingAccess.hpp>
39 #include <cppuhelper/implbase.hxx>
41 #include <comphelper/uno3.hxx>
43 #include <unobaseclass.hxx>
44 #include <TextCursorHelper.hxx>
50 typedef ::cppu::WeakImplHelper
51 < ::com::sun::star::lang::XServiceInfo
52 , ::com::sun::star::beans::XPropertySet
53 , ::com::sun::star::beans::XPropertyState
54 , ::com::sun::star::beans::XMultiPropertySet
55 , ::com::sun::star::beans::XMultiPropertyStates
56 , ::com::sun::star::container::XEnumerationAccess
57 , ::com::sun::star::container::XContentEnumerationAccess
58 , ::com::sun::star::util::XSortable
59 , ::com::sun::star::document::XDocumentInsertable
60 , ::com::sun::star::text::XSentenceCursor
61 , ::com::sun::star::text::XWordCursor
62 , ::com::sun::star::text::XParagraphCursor
63 , ::com::sun::star::text::XRedline
64 , ::com::sun::star::text::XMarkingAccess
68 : public SwXTextCursor_Base
69 , public OTextCursorHelper
75 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
77 virtual ~SwXTextCursor();
83 ::com::sun::star::uno::Reference
<
84 ::com::sun::star::text::XText
> const& xParent
,
85 const enum CursorType eType
,
86 SwPosition
const& rPos
,
87 SwPosition
const*const pMark
= 0);
89 ::com::sun::star::uno::Reference
<
90 ::com::sun::star::text::XText
> const& xParent
,
91 SwPaM
const& rSourceCursor
,
92 const enum CursorType eType
= CURSOR_ALL
);
94 SwUnoCrsr
* GetCursor();
95 const SwUnoCrsr
* GetCursor() const;
97 bool IsAtEndOfMeta() const;
99 void DeleteAndInsert(OUString
const& rText
,
100 const bool bForceExpandHints
);
103 virtual const SwPaM
* GetPaM() const SAL_OVERRIDE
;
104 virtual SwPaM
* GetPaM() SAL_OVERRIDE
;
105 virtual const SwDoc
* GetDoc() const SAL_OVERRIDE
;
106 virtual SwDoc
* GetDoc() SAL_OVERRIDE
;
110 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
113 virtual sal_Int64 SAL_CALL
getSomething(
114 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
115 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
118 virtual OUString SAL_CALL
getImplementationName()
119 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual sal_Bool SAL_CALL
supportsService(
121 const OUString
& rServiceName
)
122 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
124 getSupportedServiceNames()
125 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual ::com::sun::star::uno::Reference
<
129 ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
131 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 virtual void SAL_CALL
setPropertyValue(
133 const 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
, std::exception
) SAL_OVERRIDE
;
140 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
141 const OUString
& rPropertyName
)
142 throw (::com::sun::star::beans::UnknownPropertyException
,
143 ::com::sun::star::lang::WrappedTargetException
,
144 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual void SAL_CALL
addPropertyChangeListener(
146 const 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
, std::exception
) SAL_OVERRIDE
;
152 virtual void SAL_CALL
removePropertyChangeListener(
153 const 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
, std::exception
) SAL_OVERRIDE
;
159 virtual void SAL_CALL
addVetoableChangeListener(
160 const 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
, std::exception
) SAL_OVERRIDE
;
166 virtual void SAL_CALL
removeVetoableChangeListener(
167 const 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
, std::exception
) SAL_OVERRIDE
;
175 virtual ::com::sun::star::beans::PropertyState SAL_CALL
176 getPropertyState(const OUString
& rPropertyName
)
177 throw (::com::sun::star::beans::UnknownPropertyException
,
178 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 virtual ::com::sun::star::uno::Sequence
<
180 ::com::sun::star::beans::PropertyState
> SAL_CALL
182 const ::com::sun::star::uno::Sequence
<
183 OUString
>& rPropertyNames
)
184 throw (::com::sun::star::beans::UnknownPropertyException
,
185 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
186 virtual void SAL_CALL
setPropertyToDefault(
187 const OUString
& rPropertyName
)
188 throw (::com::sun::star::beans::UnknownPropertyException
,
189 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
190 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
191 const OUString
& rPropertyName
)
192 throw (::com::sun::star::beans::UnknownPropertyException
,
193 ::com::sun::star::lang::WrappedTargetException
,
194 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual void SAL_CALL
setPropertyValues(
198 const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
199 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aValues
)
201 css::beans::PropertyVetoException
,
202 css::lang::IllegalArgumentException
,
203 css::lang::WrappedTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
205 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
206 getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
207 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
209 virtual void SAL_CALL
addPropertiesChangeListener(
210 const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
211 const ::com::sun::star::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
)
212 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
214 virtual void SAL_CALL
removePropertiesChangeListener(
215 const ::com::sun::star::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
)
216 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
218 virtual void SAL_CALL
firePropertiesChangeEvent(
219 const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
220 const ::com::sun::star::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
)
221 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
223 // XMultiPropertyStates
224 virtual void SAL_CALL
setAllPropertiesToDefault()
225 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 virtual void SAL_CALL
setPropertiesToDefault(
227 const ::com::sun::star::uno::Sequence
< OUString
>&
229 throw (::com::sun::star::beans::UnknownPropertyException
,
230 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
231 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
232 SAL_CALL
getPropertyDefaults(
233 const ::com::sun::star::uno::Sequence
< OUString
>&
235 throw (::com::sun::star::beans::UnknownPropertyException
,
236 ::com::sun::star::lang::WrappedTargetException
,
237 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
240 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
241 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
242 virtual sal_Bool SAL_CALL
hasElements()
243 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 // XEnumerationAccess
246 virtual ::com::sun::star::uno::Reference
<
247 ::com::sun::star::container::XEnumeration
> SAL_CALL
249 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 // XContentEnumerationAccess
252 virtual ::com::sun::star::uno::Reference
<
253 ::com::sun::star::container::XEnumeration
> SAL_CALL
254 createContentEnumeration(const OUString
& rServiceName
)
255 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
256 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
257 getAvailableServiceNames()
258 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
261 virtual ::com::sun::star::uno::Sequence
<
262 ::com::sun::star::beans::PropertyValue
> SAL_CALL
263 createSortDescriptor()
264 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
265 virtual void SAL_CALL
sort(
266 const ::com::sun::star::uno::Sequence
<
267 ::com::sun::star::beans::PropertyValue
>& xDescriptor
)
268 throw (::com::sun::star::uno::RuntimeException
,
269 std::exception
) SAL_OVERRIDE
;
271 // XDocumentInsertable
272 virtual void SAL_CALL
insertDocumentFromURL(
273 const OUString
& rURL
,
274 const ::com::sun::star::uno::Sequence
<
275 ::com::sun::star::beans::PropertyValue
>& rOptions
)
276 throw (::com::sun::star::lang::IllegalArgumentException
,
277 ::com::sun::star::io::IOException
,
278 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
281 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
283 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
284 virtual ::com::sun::star::uno::Reference
<
285 ::com::sun::star::text::XTextRange
> SAL_CALL
getStart()
286 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
287 virtual ::com::sun::star::uno::Reference
<
288 ::com::sun::star::text::XTextRange
> SAL_CALL
getEnd()
289 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
290 virtual OUString SAL_CALL
getString()
291 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
292 virtual void SAL_CALL
setString(const OUString
& rString
)
293 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
296 virtual void SAL_CALL
collapseToStart()
297 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
298 virtual void SAL_CALL
collapseToEnd()
299 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
300 virtual sal_Bool SAL_CALL
isCollapsed()
301 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
302 virtual sal_Bool SAL_CALL
goLeft(sal_Int16 nCount
, sal_Bool bExpand
)
303 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
304 virtual sal_Bool SAL_CALL
goRight(sal_Int16 nCount
, sal_Bool bExpand
)
305 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
306 virtual void SAL_CALL
gotoStart(sal_Bool bExpand
)
307 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
308 virtual void SAL_CALL
gotoEnd(sal_Bool bExpand
)
309 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
310 virtual void SAL_CALL
gotoRange(
311 const ::com::sun::star::uno::Reference
<
312 ::com::sun::star::text::XTextRange
>& xRange
,
314 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
317 virtual sal_Bool SAL_CALL
isStartOfWord()
318 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
319 virtual sal_Bool SAL_CALL
isEndOfWord()
320 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
321 virtual sal_Bool SAL_CALL
gotoNextWord(sal_Bool bExpand
)
322 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
323 virtual sal_Bool SAL_CALL
gotoPreviousWord(sal_Bool bExpand
)
324 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
325 virtual sal_Bool SAL_CALL
gotoEndOfWord(sal_Bool bExpand
)
326 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
327 virtual sal_Bool SAL_CALL
gotoStartOfWord(sal_Bool bExpand
)
328 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
331 virtual sal_Bool SAL_CALL
isStartOfSentence()
332 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
333 virtual sal_Bool SAL_CALL
isEndOfSentence()
334 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
335 virtual sal_Bool SAL_CALL
gotoNextSentence(sal_Bool Expand
)
336 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
337 virtual sal_Bool SAL_CALL
gotoPreviousSentence(sal_Bool Expand
)
338 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
339 virtual sal_Bool SAL_CALL
gotoStartOfSentence(sal_Bool Expand
)
340 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
341 virtual sal_Bool SAL_CALL
gotoEndOfSentence(sal_Bool Expand
)
342 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
345 virtual sal_Bool SAL_CALL
isStartOfParagraph()
346 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
347 virtual sal_Bool SAL_CALL
isEndOfParagraph()
348 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
349 virtual sal_Bool SAL_CALL
gotoStartOfParagraph(sal_Bool Expand
)
350 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
351 virtual sal_Bool SAL_CALL
gotoEndOfParagraph(sal_Bool Expand
)
352 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
353 virtual sal_Bool SAL_CALL
gotoNextParagraph(sal_Bool Expand
)
354 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
355 virtual sal_Bool SAL_CALL
gotoPreviousParagraph(sal_Bool Expand
)
356 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
359 virtual void SAL_CALL
makeRedline(
360 const OUString
& rRedlineType
,
361 const ::com::sun::star::uno::Sequence
<
362 ::com::sun::star::beans::PropertyValue
>& RedlineProperties
)
363 throw (::com::sun::star::lang::IllegalArgumentException
,
364 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
367 virtual void SAL_CALL
invalidateMarkings(::sal_Int32 nType
)
368 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
372 #endif // INCLUDED_SW_INC_UNOTEXTCURSOR_HXX
374 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */