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/XServiceInfo.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/beans/XPropertyState.hpp>
26 #include <com/sun/star/beans/XMultiPropertySet.hpp>
27 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
28 #include <com/sun/star/container/XEnumerationAccess.hpp>
29 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
30 #include <com/sun/star/util/XSortable.hpp>
31 #include <com/sun/star/document/XDocumentInsertable.hpp>
32 #include <com/sun/star/text/XSentenceCursor.hpp>
33 #include <com/sun/star/text/XWordCursor.hpp>
34 #include <com/sun/star/text/XParagraphCursor.hpp>
35 #include <com/sun/star/text/XRedline.hpp>
36 #include <com/sun/star/text/XMarkingAccess.hpp>
38 #include <cppuhelper/implbase.hxx>
40 #include <comphelper/uno3.hxx>
42 #include "unobaseclass.hxx"
43 #include "TextCursorHelper.hxx"
49 typedef ::cppu::WeakImplHelper
50 < css::lang::XServiceInfo
51 , css::beans::XPropertySet
52 , css::beans::XPropertyState
53 , css::beans::XMultiPropertySet
54 , css::beans::XMultiPropertyStates
55 , css::container::XEnumerationAccess
56 , css::container::XContentEnumerationAccess
57 , css::util::XSortable
58 , css::document::XDocumentInsertable
59 , css::text::XSentenceCursor
60 , css::text::XWordCursor
61 , css::text::XParagraphCursor
63 , css::text::XMarkingAccess
66 class SwXTextCursor final
67 : public SwXTextCursor_Base
68 , public OTextCursorHelper
74 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
76 virtual ~SwXTextCursor() override
;
82 css::uno::Reference
< css::text::XText
> const& xParent
,
83 const CursorType eType
,
84 SwPosition
const& rPos
,
85 SwPosition
const*const pMark
= nullptr);
87 css::uno::Reference
< css::text::XText
> const& xParent
,
88 SwPaM
const& rSourceCursor
,
89 const CursorType eType
= CursorType::All
);
91 SwUnoCursor
& GetCursor();
92 bool IsAtEndOfMeta() const;
94 void DeleteAndInsert(OUString
const& rText
, ::sw::DeleteAndInsertMode eMode
);
96 virtual const SwPaM
* GetPaM() const override
;
97 virtual SwPaM
* GetPaM() override
;
98 virtual const SwDoc
* GetDoc() const override
;
99 virtual SwDoc
* GetDoc() override
;
103 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
106 virtual sal_Int64 SAL_CALL
getSomething(
107 const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
110 virtual OUString SAL_CALL
getImplementationName() override
;
111 virtual sal_Bool SAL_CALL
supportsService(
112 const OUString
& rServiceName
) override
;
113 virtual css::uno::Sequence
< OUString
> SAL_CALL
114 getSupportedServiceNames() override
;
117 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
118 getPropertySetInfo() override
;
119 virtual void SAL_CALL
setPropertyValue(
120 const OUString
& rPropertyName
,
121 const css::uno::Any
& rValue
) override
;
122 virtual css::uno::Any SAL_CALL
getPropertyValue(
123 const OUString
& rPropertyName
) override
;
124 virtual void SAL_CALL
addPropertyChangeListener(
125 const OUString
& rPropertyName
,
126 const css::uno::Reference
<
127 css::beans::XPropertyChangeListener
>& xListener
) override
;
128 virtual void SAL_CALL
removePropertyChangeListener(
129 const OUString
& rPropertyName
,
130 const css::uno::Reference
<
131 css::beans::XPropertyChangeListener
>& xListener
) override
;
132 virtual void SAL_CALL
addVetoableChangeListener(
133 const OUString
& rPropertyName
,
134 const css::uno::Reference
<
135 css::beans::XVetoableChangeListener
>& xListener
) override
;
136 virtual void SAL_CALL
removeVetoableChangeListener(
137 const OUString
& rPropertyName
,
138 const css::uno::Reference
<
139 css::beans::XVetoableChangeListener
>& xListener
) override
;
142 virtual css::beans::PropertyState SAL_CALL
143 getPropertyState(const OUString
& rPropertyName
) override
;
144 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
146 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
147 virtual void SAL_CALL
setPropertyToDefault(
148 const OUString
& rPropertyName
) override
;
149 virtual css::uno::Any SAL_CALL
getPropertyDefault(
150 const OUString
& rPropertyName
) override
;
153 virtual void SAL_CALL
setPropertyValues(
154 const css::uno::Sequence
< OUString
>& aPropertyNames
,
155 const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
157 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
158 getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
160 virtual void SAL_CALL
addPropertiesChangeListener(
161 const css::uno::Sequence
< OUString
>& aPropertyNames
,
162 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
164 virtual void SAL_CALL
removePropertiesChangeListener(
165 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
167 virtual void SAL_CALL
firePropertiesChangeEvent(
168 const css::uno::Sequence
< OUString
>& aPropertyNames
,
169 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
171 // XMultiPropertyStates
172 virtual void SAL_CALL
setAllPropertiesToDefault() override
;
173 virtual void SAL_CALL
setPropertiesToDefault(
174 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
175 virtual css::uno::Sequence
< css::uno::Any
>
176 SAL_CALL
getPropertyDefaults(
177 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
180 virtual css::uno::Type SAL_CALL
getElementType() override
;
181 virtual sal_Bool SAL_CALL
hasElements() override
;
183 // XEnumerationAccess
184 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
185 createEnumeration() override
;
187 // XContentEnumerationAccess
188 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
189 createContentEnumeration(const OUString
& rServiceName
) override
;
190 virtual css::uno::Sequence
< OUString
> SAL_CALL
191 getAvailableServiceNames() override
;
194 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
195 createSortDescriptor() override
;
196 virtual void SAL_CALL
sort(
197 const css::uno::Sequence
< css::beans::PropertyValue
>& xDescriptor
) override
;
199 // XDocumentInsertable
200 virtual void SAL_CALL
insertDocumentFromURL(
201 const OUString
& rURL
,
202 const css::uno::Sequence
< css::beans::PropertyValue
>& rOptions
) override
;
205 virtual css::uno::Reference
< css::text::XText
>
206 SAL_CALL
getText() override
;
207 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
208 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
209 virtual OUString SAL_CALL
getString() override
;
210 virtual void SAL_CALL
setString(const OUString
& rString
) override
;
213 virtual void SAL_CALL
collapseToStart() override
;
214 virtual void SAL_CALL
collapseToEnd() override
;
215 virtual sal_Bool SAL_CALL
isCollapsed() override
;
216 virtual sal_Bool SAL_CALL
goLeft(sal_Int16 nCount
, sal_Bool bExpand
) override
;
217 virtual sal_Bool SAL_CALL
goRight(sal_Int16 nCount
, sal_Bool bExpand
) override
;
218 virtual void SAL_CALL
gotoStart(sal_Bool bExpand
) override
;
219 virtual void SAL_CALL
gotoEnd(sal_Bool bExpand
) override
;
220 virtual void SAL_CALL
gotoRange(
221 const css::uno::Reference
< css::text::XTextRange
>& xRange
,
222 sal_Bool bExpand
) override
;
225 virtual sal_Bool SAL_CALL
isStartOfWord() override
;
226 virtual sal_Bool SAL_CALL
isEndOfWord() override
;
227 virtual sal_Bool SAL_CALL
gotoNextWord(sal_Bool bExpand
) override
;
228 virtual sal_Bool SAL_CALL
gotoPreviousWord(sal_Bool bExpand
) override
;
229 virtual sal_Bool SAL_CALL
gotoEndOfWord(sal_Bool bExpand
) override
;
230 virtual sal_Bool SAL_CALL
gotoStartOfWord(sal_Bool bExpand
) override
;
233 virtual sal_Bool SAL_CALL
isStartOfSentence() override
;
234 virtual sal_Bool SAL_CALL
isEndOfSentence() override
;
235 virtual sal_Bool SAL_CALL
gotoNextSentence(sal_Bool Expand
) override
;
236 virtual sal_Bool SAL_CALL
gotoPreviousSentence(sal_Bool Expand
) override
;
237 virtual sal_Bool SAL_CALL
gotoStartOfSentence(sal_Bool Expand
) override
;
238 virtual sal_Bool SAL_CALL
gotoEndOfSentence(sal_Bool Expand
) override
;
241 virtual sal_Bool SAL_CALL
isStartOfParagraph() override
;
242 virtual sal_Bool SAL_CALL
isEndOfParagraph() override
;
243 virtual sal_Bool SAL_CALL
gotoStartOfParagraph(sal_Bool Expand
) override
;
244 virtual sal_Bool SAL_CALL
gotoEndOfParagraph(sal_Bool Expand
) override
;
245 virtual sal_Bool SAL_CALL
gotoNextParagraph(sal_Bool Expand
) override
;
246 virtual sal_Bool SAL_CALL
gotoPreviousParagraph(sal_Bool Expand
) override
;
249 virtual void SAL_CALL
makeRedline(
250 const OUString
& rRedlineType
,
251 const css::uno::Sequence
< css::beans::PropertyValue
>& RedlineProperties
) override
;
254 virtual void SAL_CALL
invalidateMarkings(::sal_Int32 nType
) override
;
258 #endif // INCLUDED_SW_INC_UNOTEXTCURSOR_HXX
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */