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_UNOTEXT_HXX
21 #define INCLUDED_SW_INC_UNOTEXT_HXX
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/text/XTextCopy.hpp>
26 #include <com/sun/star/text/XTextRangeCompare.hpp>
27 #include <com/sun/star/text/XRelativeTextContentInsert.hpp>
28 #include <com/sun/star/text/XRelativeTextContentRemove.hpp>
29 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
30 #include <sal/types.h>
32 #include "unobaseclass.hxx"
34 namespace com::sun::star
{
41 class SfxItemPropertySet
;
51 class SAL_DLLPUBLIC_RTTI
SAL_LOPLUGIN_ANNOTATE("crosscast") SwXText
52 : public css::lang::XTypeProvider
53 , public css::beans::XPropertySet
54 , public css::text::XTextAppendAndConvert
55 , public css::text::XTextCopy
56 , public css::text::XTextRangeCompare
57 , public css::text::XRelativeTextContentInsert
58 , public css::text::XRelativeTextContentRemove
63 virtual void PrepareForAttach(
64 css::uno::Reference
< css::text::XTextRange
> & xRange
,
66 /// @throws css::lang::IllegalArgumentException
67 /// @throws css::uno::RuntimeException
68 virtual bool CheckForOwnMemberMeta(
69 const SwPaM
& rPam
, const bool bAbsorb
);
70 bool CheckForOwnMember(const SwPaM
& rPaM
);
71 sal_Int16
ComparePositions(
72 const css::uno::Reference
<css::text::XTextRange
>& xPos1
,
73 const css::uno::Reference
<css::text::XTextRange
>& xPos2
);
74 rtl::Reference
<SwXParagraph
> finishOrAppendParagraph(
75 const css::uno::Sequence
< css::beans::PropertyValue
> & rProperties
,
76 const css::uno::Reference
< css::text::XTextRange
>& xInsertPosition
);
78 const css::uno::Sequence
< css::uno::Reference
< css::text::XTextRange
> > & rCell
,
79 std::vector
<SwNodeRange
> & rRowNodes
,
80 SwNodeRange
*const pLastCell
);
84 bool IsValid() const { return m_bIsValid
; }
85 void Invalidate() { m_bIsValid
= false; }
86 void SetDoc(SwDoc
*const pDoc
);
90 public: /*not protected because C++ is retarded*/
91 virtual const SwStartNode
*GetStartNode() const;
95 SwXText(SwDoc
*const pDoc
, const CursorType eType
);
97 const SwDoc
* GetDoc() const { return m_pDoc
; }
98 SwDoc
* GetDoc() { return m_pDoc
; }
100 // declare these here to resolve ambiguity when we declared rtl::Reference<subtype-of-SwXText>
101 virtual void SAL_CALL
acquire() override
= 0;
102 virtual void SAL_CALL
release() override
= 0;
105 virtual css::uno::Any SAL_CALL
queryInterface(
106 const css::uno::Type
& rType
) override
;
109 virtual css::uno::Sequence
< css::uno::Type
>
110 SAL_CALL
getTypes() override
;
113 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
114 getPropertySetInfo() override
;
115 virtual void SAL_CALL
setPropertyValue(
116 const OUString
& rPropertyName
,
117 const css::uno::Any
& rValue
) override
;
118 virtual css::uno::Any SAL_CALL
getPropertyValue(
119 const OUString
& rPropertyName
) override
;
120 virtual void SAL_CALL
addPropertyChangeListener(
121 const OUString
& rPropertyName
,
122 const css::uno::Reference
<
123 css::beans::XPropertyChangeListener
>& xListener
) override
;
124 virtual void SAL_CALL
removePropertyChangeListener(
125 const OUString
& rPropertyName
,
126 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
127 virtual void SAL_CALL
addVetoableChangeListener(
128 const OUString
& rPropertyName
,
129 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
130 virtual void SAL_CALL
removeVetoableChangeListener(
131 const OUString
& rPropertyName
,
132 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
135 virtual css::uno::Reference
< css::text::XText
>
136 SAL_CALL
getText() override
;
137 SW_DLLPUBLIC
virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
138 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
139 SW_DLLPUBLIC
virtual OUString SAL_CALL
getString() override
;
140 SW_DLLPUBLIC
virtual void SAL_CALL
setString(const OUString
& rString
) override
;
143 virtual void SAL_CALL
insertString(
144 const css::uno::Reference
< css::text::XTextRange
> & xRange
,
145 const OUString
& aString
, sal_Bool bAbsorb
) override
;
146 virtual void SAL_CALL
insertControlCharacter(
147 const css::uno::Reference
< css::text::XTextRange
> & xRange
,
148 sal_Int16 nControlCharacter
, sal_Bool bAbsorb
) override
;
149 SW_DLLPUBLIC
virtual css::uno::Reference
< css::text::XTextCursor
> SAL_CALL
createTextCursorByRange(
150 const ::css::uno::Reference
< ::css::text::XTextRange
>& aTextPosition
) override final
;
151 virtual rtl::Reference
< SwXTextCursor
> createXTextCursorByRange(
152 const ::css::uno::Reference
< ::css::text::XTextRange
>& aTextPosition
) = 0;
153 virtual css::uno::Reference
< css::text::XTextCursor
> SAL_CALL
createTextCursor() override final
;
154 virtual rtl::Reference
< SwXTextCursor
> createXTextCursor() = 0;
157 virtual void SAL_CALL
insertTextContent(
158 const css::uno::Reference
< css::text::XTextRange
> & xRange
,
159 const css::uno::Reference
< css::text::XTextContent
> & xContent
,
160 sal_Bool bAbsorb
) override
;
161 virtual void SAL_CALL
removeTextContent(
162 const css::uno::Reference
< css::text::XTextContent
> & xContent
) override
;
165 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
167 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
) override
;
168 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
169 finishParagraphInsert(
170 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
,
171 const css::uno::Reference
< css::text::XTextRange
>& xInsertPosition
) override
;
173 // XTextPortionAppend
174 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
176 const OUString
& rText
,
177 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
) override
;
179 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
181 const OUString
& rText
,
182 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
,
183 const css::uno::Reference
< css::text::XTextRange
>& rTextRange
) override
;
185 // XTextContentAppend
186 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
188 const css::uno::Reference
< css::text::XTextContent
>& xTextContent
,
189 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
) override
;
190 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
191 insertTextContentWithProperties(
192 const css::uno::Reference
< css::text::XTextContent
>& xTextContent
,
193 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
,
194 const css::uno::Reference
< css::text::XTextRange
>& xInsertPosition
) override
;
197 virtual css::uno::Reference
< css::text::XTextContent
> SAL_CALL
199 const css::uno::Reference
< css::text::XTextRange
>& xStart
,
200 const css::uno::Reference
< css::text::XTextRange
>& xEnd
,
201 const css::uno::Sequence
< css::beans::PropertyValue
>& xFrameProperties
) override
;
202 virtual css::uno::Reference
<
203 css::text::XTextTable
> SAL_CALL
209 css::text::XTextRange
> > > > const&
214 css::beans::PropertyValue
> > > const&
218 css::beans::PropertyValue
> > const&
221 css::beans::PropertyValue
> const&
222 rTableProperties
) override
;
225 SW_DLLPUBLIC
virtual void SAL_CALL
copyText(
226 const css::uno::Reference
< css::text::XTextCopy
>& xSource
) override
;
229 sal_Int16 SAL_CALL
compareRegionStarts(
230 const css::uno::Reference
< css::text::XTextRange
>& xR1
,
231 const css::uno::Reference
< css::text::XTextRange
>& xR2
) override
;
232 sal_Int16 SAL_CALL
compareRegionEnds(
233 const css::uno::Reference
< css::text::XTextRange
>& xR1
,
234 const css::uno::Reference
< css::text::XTextRange
>& xR2
) override
;
236 // XRelativeTextContentInsert
237 virtual void SAL_CALL
insertTextContentBefore(
238 const css::uno::Reference
< css::text::XTextContent
>& xNewContent
,
239 const css::uno::Reference
< css::text::XTextContent
>& xSuccessor
) override
;
240 virtual void SAL_CALL
insertTextContentAfter(
241 const css::uno::Reference
< css::text::XTextContent
>& xNewContent
,
242 const css::uno::Reference
< css::text::XTextContent
>& xPredecessor
) override
;
244 // XRelativeTextContentRemove
245 virtual void SAL_CALL
removeTextContentBefore(
246 const css::uno::Reference
< css::text::XTextContent
>& xSuccessor
) override
;
247 virtual void SAL_CALL
removeTextContentAfter(
248 const css::uno::Reference
< css::text::XTextContent
>& xPredecessor
) override
;
250 SW_DLLPUBLIC
rtl::Reference
< SwXTextTable
>
256 css::text::XTextRange
> > > > const&
261 css::beans::PropertyValue
> > > const&
265 css::beans::PropertyValue
> > const&
268 css::beans::PropertyValue
> const&
272 rtl::Reference
< SwXTextCursor
> getEndImpl(SolarMutexGuard
& rGuard
);
273 rtl::Reference
< SwXTextRange
> insertTextPortionImpl(
274 SolarMutexGuard
& rGuard
,
275 std::u16string_view rText
,
276 const css::uno::Sequence
< css::beans::PropertyValue
>& rCharacterAndParagraphProperties
,
277 const rtl::Reference
<SwXTextCursor
>& xTextCursor
);
279 SfxItemPropertySet
const& m_rPropSet
;
280 const CursorType m_eType
;
285 #endif // INCLUDED_SW_INC_UNOTEXT_HXX
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */