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 < css::lang::XServiceInfo
52 , css::beans::XPropertySet
53 , css::beans::XPropertyState
54 , css::beans::XMultiPropertySet
55 , css::beans::XMultiPropertyStates
56 , css::container::XEnumerationAccess
57 , css::container::XContentEnumerationAccess
58 , css::util::XSortable
59 , css::document::XDocumentInsertable
60 , css::text::XSentenceCursor
61 , css::text::XWordCursor
62 , css::text::XParagraphCursor
64 , css::text::XMarkingAccess
68 : public SwXTextCursor_Base
69 , public OTextCursorHelper
75 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
77 virtual ~SwXTextCursor() override
;
83 css::uno::Reference
< css::text::XText
> const& xParent
,
84 const CursorType eType
,
85 SwPosition
const& rPos
,
86 SwPosition
const*const pMark
= nullptr);
88 css::uno::Reference
< css::text::XText
> const& xParent
,
89 SwPaM
const& rSourceCursor
,
90 const CursorType eType
= CursorType::All
);
92 SwUnoCursor
& GetCursor();
93 bool IsAtEndOfMeta() const;
95 void DeleteAndInsert(OUString
const& rText
,
96 const bool bForceExpandHints
);
99 virtual const SwPaM
* GetPaM() const override
;
100 virtual SwPaM
* GetPaM() override
;
101 virtual const SwDoc
* GetDoc() const override
;
102 virtual SwDoc
* GetDoc() override
;
106 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
109 virtual sal_Int64 SAL_CALL
getSomething(
110 const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
113 virtual OUString SAL_CALL
getImplementationName() override
;
114 virtual sal_Bool SAL_CALL
supportsService(
115 const OUString
& rServiceName
) override
;
116 virtual css::uno::Sequence
< OUString
> SAL_CALL
117 getSupportedServiceNames() override
;
120 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
121 getPropertySetInfo() override
;
122 virtual void SAL_CALL
setPropertyValue(
123 const OUString
& rPropertyName
,
124 const css::uno::Any
& rValue
) override
;
125 virtual css::uno::Any SAL_CALL
getPropertyValue(
126 const OUString
& rPropertyName
) override
;
127 virtual void SAL_CALL
addPropertyChangeListener(
128 const OUString
& rPropertyName
,
129 const css::uno::Reference
<
130 css::beans::XPropertyChangeListener
>& xListener
) override
;
131 virtual void SAL_CALL
removePropertyChangeListener(
132 const OUString
& rPropertyName
,
133 const css::uno::Reference
<
134 css::beans::XPropertyChangeListener
>& xListener
) override
;
135 virtual void SAL_CALL
addVetoableChangeListener(
136 const OUString
& rPropertyName
,
137 const css::uno::Reference
<
138 css::beans::XVetoableChangeListener
>& xListener
) override
;
139 virtual void SAL_CALL
removeVetoableChangeListener(
140 const OUString
& rPropertyName
,
141 const css::uno::Reference
<
142 css::beans::XVetoableChangeListener
>& xListener
) override
;
145 virtual css::beans::PropertyState SAL_CALL
146 getPropertyState(const OUString
& rPropertyName
) override
;
147 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
149 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
150 virtual void SAL_CALL
setPropertyToDefault(
151 const OUString
& rPropertyName
) override
;
152 virtual css::uno::Any SAL_CALL
getPropertyDefault(
153 const OUString
& rPropertyName
) override
;
156 virtual void SAL_CALL
setPropertyValues(
157 const css::uno::Sequence
< OUString
>& aPropertyNames
,
158 const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
160 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
161 getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
163 virtual void SAL_CALL
addPropertiesChangeListener(
164 const css::uno::Sequence
< OUString
>& aPropertyNames
,
165 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
167 virtual void SAL_CALL
removePropertiesChangeListener(
168 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
170 virtual void SAL_CALL
firePropertiesChangeEvent(
171 const css::uno::Sequence
< OUString
>& aPropertyNames
,
172 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
174 // XMultiPropertyStates
175 virtual void SAL_CALL
setAllPropertiesToDefault() override
;
176 virtual void SAL_CALL
setPropertiesToDefault(
177 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
178 virtual css::uno::Sequence
< css::uno::Any
>
179 SAL_CALL
getPropertyDefaults(
180 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
183 virtual css::uno::Type SAL_CALL
getElementType() override
;
184 virtual sal_Bool SAL_CALL
hasElements() override
;
186 // XEnumerationAccess
187 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
188 createEnumeration() override
;
190 // XContentEnumerationAccess
191 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
192 createContentEnumeration(const OUString
& rServiceName
) override
;
193 virtual css::uno::Sequence
< OUString
> SAL_CALL
194 getAvailableServiceNames() override
;
197 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
198 createSortDescriptor() override
;
199 virtual void SAL_CALL
sort(
200 const css::uno::Sequence
< css::beans::PropertyValue
>& xDescriptor
) override
;
202 // XDocumentInsertable
203 virtual void SAL_CALL
insertDocumentFromURL(
204 const OUString
& rURL
,
205 const css::uno::Sequence
< css::beans::PropertyValue
>& rOptions
) override
;
208 virtual css::uno::Reference
< css::text::XText
>
209 SAL_CALL
getText() override
;
210 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
211 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
212 virtual OUString SAL_CALL
getString() override
;
213 virtual void SAL_CALL
setString(const OUString
& rString
) override
;
216 virtual void SAL_CALL
collapseToStart() override
;
217 virtual void SAL_CALL
collapseToEnd() override
;
218 virtual sal_Bool SAL_CALL
isCollapsed() override
;
219 virtual sal_Bool SAL_CALL
goLeft(sal_Int16 nCount
, sal_Bool bExpand
) override
;
220 virtual sal_Bool SAL_CALL
goRight(sal_Int16 nCount
, sal_Bool bExpand
) override
;
221 virtual void SAL_CALL
gotoStart(sal_Bool bExpand
) override
;
222 virtual void SAL_CALL
gotoEnd(sal_Bool bExpand
) override
;
223 virtual void SAL_CALL
gotoRange(
224 const css::uno::Reference
< css::text::XTextRange
>& xRange
,
225 sal_Bool bExpand
) override
;
228 virtual sal_Bool SAL_CALL
isStartOfWord() override
;
229 virtual sal_Bool SAL_CALL
isEndOfWord() override
;
230 virtual sal_Bool SAL_CALL
gotoNextWord(sal_Bool bExpand
) override
;
231 virtual sal_Bool SAL_CALL
gotoPreviousWord(sal_Bool bExpand
) override
;
232 virtual sal_Bool SAL_CALL
gotoEndOfWord(sal_Bool bExpand
) override
;
233 virtual sal_Bool SAL_CALL
gotoStartOfWord(sal_Bool bExpand
) override
;
236 virtual sal_Bool SAL_CALL
isStartOfSentence() override
;
237 virtual sal_Bool SAL_CALL
isEndOfSentence() override
;
238 virtual sal_Bool SAL_CALL
gotoNextSentence(sal_Bool Expand
) override
;
239 virtual sal_Bool SAL_CALL
gotoPreviousSentence(sal_Bool Expand
) override
;
240 virtual sal_Bool SAL_CALL
gotoStartOfSentence(sal_Bool Expand
) override
;
241 virtual sal_Bool SAL_CALL
gotoEndOfSentence(sal_Bool Expand
) override
;
244 virtual sal_Bool SAL_CALL
isStartOfParagraph() override
;
245 virtual sal_Bool SAL_CALL
isEndOfParagraph() override
;
246 virtual sal_Bool SAL_CALL
gotoStartOfParagraph(sal_Bool Expand
) override
;
247 virtual sal_Bool SAL_CALL
gotoEndOfParagraph(sal_Bool Expand
) override
;
248 virtual sal_Bool SAL_CALL
gotoNextParagraph(sal_Bool Expand
) override
;
249 virtual sal_Bool SAL_CALL
gotoPreviousParagraph(sal_Bool Expand
) override
;
252 virtual void SAL_CALL
makeRedline(
253 const OUString
& rRedlineType
,
254 const css::uno::Sequence
< css::beans::PropertyValue
>& RedlineProperties
) override
;
257 virtual void SAL_CALL
invalidateMarkings(::sal_Int32 nType
) override
;
261 #endif // INCLUDED_SW_INC_UNOTEXTCURSOR_HXX
263 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */