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 SW_UNOTEXTCURSOR_HXX
21 #define SW_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>
38 #include <cppuhelper/implbase13.hxx>
40 #include <comphelper/uno3.hxx>
42 #include <unobaseclass.hxx>
43 #include <TextCursorHelper.hxx>
51 typedef ::cppu::WeakImplHelper13
52 < ::com::sun::star::lang::XServiceInfo
53 , ::com::sun::star::beans::XPropertySet
54 , ::com::sun::star::beans::XPropertyState
55 , ::com::sun::star::beans::XMultiPropertySet
56 , ::com::sun::star::beans::XMultiPropertyStates
57 , ::com::sun::star::container::XEnumerationAccess
58 , ::com::sun::star::container::XContentEnumerationAccess
59 , ::com::sun::star::util::XSortable
60 , ::com::sun::star::document::XDocumentInsertable
61 , ::com::sun::star::text::XSentenceCursor
62 , ::com::sun::star::text::XWordCursor
63 , ::com::sun::star::text::XParagraphCursor
64 , ::com::sun::star::text::XRedline
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;
104 virtual SwPaM
* GetPaM();
105 virtual const SwDoc
* GetDoc() const;
106 virtual SwDoc
* GetDoc();
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
);
118 virtual OUString SAL_CALL
getImplementationName()
119 throw (::com::sun::star::uno::RuntimeException
);
120 virtual sal_Bool SAL_CALL
supportsService(
121 const OUString
& rServiceName
)
122 throw (::com::sun::star::uno::RuntimeException
);
123 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
124 getSupportedServiceNames()
125 throw (::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::uno::Reference
<
129 ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
131 throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
186 virtual void SAL_CALL
setPropertyToDefault(
187 const OUString
& rPropertyName
)
188 throw (::com::sun::star::beans::UnknownPropertyException
,
189 ::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
214 virtual void SAL_CALL
removePropertiesChangeListener(
215 const ::com::sun::star::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
)
216 throw (css::uno::RuntimeException
);
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
);
223 // XMultiPropertyStates
224 virtual void SAL_CALL
setAllPropertiesToDefault()
225 throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
240 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
241 throw (::com::sun::star::uno::RuntimeException
);
242 virtual sal_Bool SAL_CALL
hasElements()
243 throw (::com::sun::star::uno::RuntimeException
);
245 // XEnumerationAccess
246 virtual ::com::sun::star::uno::Reference
<
247 ::com::sun::star::container::XEnumeration
> SAL_CALL
249 throw (::com::sun::star::uno::RuntimeException
);
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
);
256 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
257 getAvailableServiceNames()
258 throw (::com::sun::star::uno::RuntimeException
);
261 virtual ::com::sun::star::uno::Sequence
<
262 ::com::sun::star::beans::PropertyValue
> SAL_CALL
263 createSortDescriptor()
264 throw (::com::sun::star::uno::RuntimeException
);
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
);
270 // XDocumentInsertable
271 virtual void SAL_CALL
insertDocumentFromURL(
272 const OUString
& rURL
,
273 const ::com::sun::star::uno::Sequence
<
274 ::com::sun::star::beans::PropertyValue
>& rOptions
)
275 throw (::com::sun::star::lang::IllegalArgumentException
,
276 ::com::sun::star::io::IOException
,
277 ::com::sun::star::uno::RuntimeException
);
280 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
282 throw (::com::sun::star::uno::RuntimeException
);
283 virtual ::com::sun::star::uno::Reference
<
284 ::com::sun::star::text::XTextRange
> SAL_CALL
getStart()
285 throw (::com::sun::star::uno::RuntimeException
);
286 virtual ::com::sun::star::uno::Reference
<
287 ::com::sun::star::text::XTextRange
> SAL_CALL
getEnd()
288 throw (::com::sun::star::uno::RuntimeException
);
289 virtual OUString SAL_CALL
getString()
290 throw (::com::sun::star::uno::RuntimeException
);
291 virtual void SAL_CALL
setString(const OUString
& rString
)
292 throw (::com::sun::star::uno::RuntimeException
);
295 virtual void SAL_CALL
collapseToStart()
296 throw (::com::sun::star::uno::RuntimeException
);
297 virtual void SAL_CALL
collapseToEnd()
298 throw (::com::sun::star::uno::RuntimeException
);
299 virtual sal_Bool SAL_CALL
isCollapsed()
300 throw (::com::sun::star::uno::RuntimeException
);
301 virtual sal_Bool SAL_CALL
goLeft(sal_Int16 nCount
, sal_Bool bExpand
)
302 throw (::com::sun::star::uno::RuntimeException
);
303 virtual sal_Bool SAL_CALL
goRight(sal_Int16 nCount
, sal_Bool bExpand
)
304 throw (::com::sun::star::uno::RuntimeException
);
305 virtual void SAL_CALL
gotoStart(sal_Bool bExpand
)
306 throw (::com::sun::star::uno::RuntimeException
);
307 virtual void SAL_CALL
gotoEnd(sal_Bool bExpand
)
308 throw (::com::sun::star::uno::RuntimeException
);
309 virtual void SAL_CALL
gotoRange(
310 const ::com::sun::star::uno::Reference
<
311 ::com::sun::star::text::XTextRange
>& xRange
,
313 throw (::com::sun::star::uno::RuntimeException
);
316 virtual sal_Bool SAL_CALL
isStartOfWord()
317 throw (::com::sun::star::uno::RuntimeException
);
318 virtual sal_Bool SAL_CALL
isEndOfWord()
319 throw (::com::sun::star::uno::RuntimeException
);
320 virtual sal_Bool SAL_CALL
gotoNextWord(sal_Bool bExpand
)
321 throw (::com::sun::star::uno::RuntimeException
);
322 virtual sal_Bool SAL_CALL
gotoPreviousWord(sal_Bool bExpand
)
323 throw (::com::sun::star::uno::RuntimeException
);
324 virtual sal_Bool SAL_CALL
gotoEndOfWord(sal_Bool bExpand
)
325 throw (::com::sun::star::uno::RuntimeException
);
326 virtual sal_Bool SAL_CALL
gotoStartOfWord(sal_Bool bExpand
)
327 throw (::com::sun::star::uno::RuntimeException
);
330 virtual sal_Bool SAL_CALL
isStartOfSentence()
331 throw (::com::sun::star::uno::RuntimeException
);
332 virtual sal_Bool SAL_CALL
isEndOfSentence()
333 throw (::com::sun::star::uno::RuntimeException
);
334 virtual sal_Bool SAL_CALL
gotoNextSentence(sal_Bool Expand
)
335 throw (::com::sun::star::uno::RuntimeException
);
336 virtual sal_Bool SAL_CALL
gotoPreviousSentence(sal_Bool Expand
)
337 throw (::com::sun::star::uno::RuntimeException
);
338 virtual sal_Bool SAL_CALL
gotoStartOfSentence(sal_Bool Expand
)
339 throw (::com::sun::star::uno::RuntimeException
);
340 virtual sal_Bool SAL_CALL
gotoEndOfSentence(sal_Bool Expand
)
341 throw (::com::sun::star::uno::RuntimeException
);
344 virtual sal_Bool SAL_CALL
isStartOfParagraph()
345 throw (::com::sun::star::uno::RuntimeException
);
346 virtual sal_Bool SAL_CALL
isEndOfParagraph()
347 throw (::com::sun::star::uno::RuntimeException
);
348 virtual sal_Bool SAL_CALL
gotoStartOfParagraph(sal_Bool Expand
)
349 throw (::com::sun::star::uno::RuntimeException
);
350 virtual sal_Bool SAL_CALL
gotoEndOfParagraph(sal_Bool Expand
)
351 throw (::com::sun::star::uno::RuntimeException
);
352 virtual sal_Bool SAL_CALL
gotoNextParagraph(sal_Bool Expand
)
353 throw (::com::sun::star::uno::RuntimeException
);
354 virtual sal_Bool SAL_CALL
gotoPreviousParagraph(sal_Bool Expand
)
355 throw (::com::sun::star::uno::RuntimeException
);
358 virtual void SAL_CALL
makeRedline(
359 const OUString
& rRedlineType
,
360 const ::com::sun::star::uno::Sequence
<
361 ::com::sun::star::beans::PropertyValue
>& RedlineProperties
)
362 throw (::com::sun::star::lang::IllegalArgumentException
,
363 ::com::sun::star::uno::RuntimeException
);
367 #endif // SW_UNOTEXTCURSOR_HXX
369 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */