/src/libreoffice/sw/inc/unotext.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_SW_INC_UNOTEXT_HXX |
21 | | #define INCLUDED_SW_INC_UNOTEXT_HXX |
22 | | |
23 | | #include "swdllapi.h" |
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> |
31 | | |
32 | | #include "unobaseclass.hxx" |
33 | | |
34 | | class SfxItemPropertySet; |
35 | | class SwDoc; |
36 | | class SwStartNode; |
37 | | class SwNodeRange; |
38 | | class SwPaM; |
39 | | class SwXTextCursor; |
40 | | class SwXParagraph; |
41 | | class SwXTextRange; |
42 | | class SwXTextTable; |
43 | | class SwXTextFrame; |
44 | | |
45 | | class SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") SwXText |
46 | | : public css::lang::XTypeProvider |
47 | | , public css::beans::XPropertySet |
48 | | , public css::text::XTextAppendAndConvert |
49 | | , public css::text::XTextCopy |
50 | | , public css::text::XTextRangeCompare |
51 | | , public css::text::XRelativeTextContentInsert |
52 | | , public css::text::XRelativeTextContentRemove |
53 | | { |
54 | | |
55 | | private: |
56 | | |
57 | | virtual void PrepareForAttach( |
58 | | css::uno::Reference< css::text::XTextRange > & xRange, |
59 | | SwPaM const & rPam); |
60 | | /// @throws css::lang::IllegalArgumentException |
61 | | /// @throws css::uno::RuntimeException |
62 | | virtual bool CheckForOwnMemberMeta( |
63 | | const SwPaM & rPam, const bool bAbsorb); |
64 | | bool CheckForOwnMember(const SwPaM & rPaM); |
65 | | sal_Int16 ComparePositions( |
66 | | const css::uno::Reference<css::text::XTextRange>& xPos1, |
67 | | const css::uno::Reference<css::text::XTextRange>& xPos2); |
68 | | rtl::Reference<SwXParagraph> finishOrAppendParagraph( |
69 | | const css::uno::Sequence< css::beans::PropertyValue > & rProperties, |
70 | | const css::uno::Reference< css::text::XTextRange >& xInsertPosition); |
71 | | void ConvertCell( |
72 | | const css::uno::Sequence< css::uno::Reference< css::text::XTextRange > > & rCell, |
73 | | std::vector<SwNodeRange> & rRowNodes, |
74 | | SwNodeRange *const pLastCell); |
75 | | |
76 | | protected: |
77 | | |
78 | 634k | bool IsValid() const { return m_bIsValid; } |
79 | 121 | void Invalidate() { m_bIsValid = false; } |
80 | | void SetDoc(SwDoc *const pDoc); |
81 | | |
82 | | virtual ~SwXText(); |
83 | | |
84 | | public: /*not protected because C++ is retarded*/ |
85 | | virtual const SwStartNode *GetStartNode() const; |
86 | | |
87 | | public: |
88 | | |
89 | | SwXText(SwDoc *const pDoc, const CursorType eType); |
90 | | |
91 | 196k | const SwDoc* GetDoc() const { return m_pDoc; } |
92 | 2.45M | SwDoc* GetDoc() { return m_pDoc; } |
93 | | |
94 | | // declare these here to resolve ambiguity when we declared rtl::Reference<subtype-of-SwXText> |
95 | | virtual void SAL_CALL acquire() override = 0; |
96 | | virtual void SAL_CALL release() override = 0; |
97 | | |
98 | | // XInterface |
99 | | virtual css::uno::Any SAL_CALL queryInterface( |
100 | | const css::uno::Type& rType) override; |
101 | | |
102 | | // XTypeProvider |
103 | | virtual css::uno::Sequence< css::uno::Type > |
104 | | SAL_CALL getTypes() override; |
105 | | |
106 | | // XPropertySet |
107 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL |
108 | | getPropertySetInfo() override; |
109 | | virtual void SAL_CALL setPropertyValue( |
110 | | const OUString& rPropertyName, |
111 | | const css::uno::Any& rValue) override; |
112 | | virtual css::uno::Any SAL_CALL getPropertyValue( |
113 | | const OUString& rPropertyName) override; |
114 | | virtual void SAL_CALL addPropertyChangeListener( |
115 | | const OUString& rPropertyName, |
116 | | const css::uno::Reference< |
117 | | css::beans::XPropertyChangeListener >& xListener) override; |
118 | | virtual void SAL_CALL removePropertyChangeListener( |
119 | | const OUString& rPropertyName, |
120 | | const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; |
121 | | virtual void SAL_CALL addVetoableChangeListener( |
122 | | const OUString& rPropertyName, |
123 | | const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; |
124 | | virtual void SAL_CALL removeVetoableChangeListener( |
125 | | const OUString& rPropertyName, |
126 | | const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; |
127 | | |
128 | | // XTextRange |
129 | | virtual css::uno::Reference< css::text::XText > |
130 | | SAL_CALL getText() override; |
131 | | SW_DLLPUBLIC virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; |
132 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; |
133 | | SW_DLLPUBLIC virtual OUString SAL_CALL getString() override; |
134 | | SW_DLLPUBLIC virtual void SAL_CALL setString(const OUString& rString) override; |
135 | | |
136 | | // XSimpleText |
137 | | virtual void SAL_CALL insertString( |
138 | | const css::uno::Reference< css::text::XTextRange > & xRange, |
139 | | const OUString& aString, sal_Bool bAbsorb) override; |
140 | | virtual void SAL_CALL insertControlCharacter( |
141 | | const css::uno::Reference< css::text::XTextRange > & xRange, |
142 | | sal_Int16 nControlCharacter, sal_Bool bAbsorb) override; |
143 | | SW_DLLPUBLIC virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange( |
144 | | const ::css::uno::Reference< ::css::text::XTextRange >& aTextPosition ) override final; |
145 | | virtual rtl::Reference< SwXTextCursor > createXTextCursorByRange( |
146 | | const ::css::uno::Reference< ::css::text::XTextRange >& aTextPosition ) = 0; |
147 | | virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override final; |
148 | | virtual rtl::Reference< SwXTextCursor > createXTextCursor() = 0; |
149 | | |
150 | | // XText |
151 | | virtual void SAL_CALL insertTextContent( |
152 | | const css::uno::Reference< css::text::XTextRange > & xRange, |
153 | | const css::uno::Reference< css::text::XTextContent > & xContent, |
154 | | sal_Bool bAbsorb) override; |
155 | | virtual void SAL_CALL removeTextContent( |
156 | | const css::uno::Reference< css::text::XTextContent > & xContent) override; |
157 | | |
158 | | // XParagraphAppend |
159 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
160 | | finishParagraph( |
161 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; |
162 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
163 | | finishParagraphInsert( |
164 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, |
165 | | const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override final; |
166 | | |
167 | | // XTextPortionAppend |
168 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
169 | | appendTextPortion( |
170 | | const OUString& rText, |
171 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; |
172 | | |
173 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
174 | | insertTextPortion( |
175 | | const OUString& rText, |
176 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, |
177 | | const css::uno::Reference< css::text::XTextRange >& rTextRange) override; |
178 | | |
179 | | // XTextContentAppend |
180 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
181 | | appendTextContent( |
182 | | const css::uno::Reference< css::text::XTextContent >& xTextContent, |
183 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; |
184 | | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL |
185 | | insertTextContentWithProperties( |
186 | | const css::uno::Reference< css::text::XTextContent >& xTextContent, |
187 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, |
188 | | const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override; |
189 | | |
190 | | // XTextConvert |
191 | | virtual css::uno::Reference< css::text::XTextContent > SAL_CALL |
192 | | convertToTextFrame( |
193 | | const css::uno::Reference< css::text::XTextRange >& xStart, |
194 | | const css::uno::Reference< css::text::XTextRange >& xEnd, |
195 | | const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override final; |
196 | | virtual css::uno::Reference< |
197 | | css::text::XTextTable > SAL_CALL |
198 | | convertToTable( |
199 | | css::uno::Sequence< |
200 | | css::uno::Sequence< |
201 | | css::uno::Sequence< |
202 | | css::uno::Reference< |
203 | | css::text::XTextRange > > > > const& |
204 | | rTableRanges, |
205 | | css::uno::Sequence< |
206 | | css::uno::Sequence< |
207 | | css::uno::Sequence< |
208 | | css::beans::PropertyValue > > > const& |
209 | | rCellProperties, |
210 | | css::uno::Sequence< |
211 | | css::uno::Sequence< |
212 | | css::beans::PropertyValue > > const& |
213 | | rRowProperties, |
214 | | css::uno::Sequence< |
215 | | css::beans::PropertyValue > const& |
216 | | rTableProperties) override; |
217 | | |
218 | | // XTextCopy |
219 | | SW_DLLPUBLIC virtual void SAL_CALL copyText( |
220 | | const css::uno::Reference< css::text::XTextCopy >& xSource ) override; |
221 | | |
222 | | // XTextRangeCompare |
223 | | sal_Int16 SAL_CALL compareRegionStarts( |
224 | | const css::uno::Reference< css::text::XTextRange >& xR1, |
225 | | const css::uno::Reference< css::text::XTextRange >& xR2) override; |
226 | | sal_Int16 SAL_CALL compareRegionEnds( |
227 | | const css::uno::Reference< css::text::XTextRange >& xR1, |
228 | | const css::uno::Reference< css::text::XTextRange >& xR2) override; |
229 | | |
230 | | // XRelativeTextContentInsert |
231 | | virtual void SAL_CALL insertTextContentBefore( |
232 | | const css::uno::Reference< css::text::XTextContent>& xNewContent, |
233 | | const css::uno::Reference< css::text::XTextContent>& xSuccessor) override; |
234 | | virtual void SAL_CALL insertTextContentAfter( |
235 | | const css::uno::Reference< css::text::XTextContent>& xNewContent, |
236 | | const css::uno::Reference< css::text::XTextContent>& xPredecessor) override; |
237 | | |
238 | | // XRelativeTextContentRemove |
239 | | virtual void SAL_CALL removeTextContentBefore( |
240 | | const css::uno::Reference< css::text::XTextContent>& xSuccessor) override; |
241 | | virtual void SAL_CALL removeTextContentAfter( |
242 | | const css::uno::Reference< css::text::XTextContent>& xPredecessor) override; |
243 | | |
244 | | SW_DLLPUBLIC rtl::Reference< SwXParagraph > |
245 | | finishSwParagraphInsert( |
246 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, |
247 | | const css::uno::Reference< css::text::XTextRange >& xInsertPosition); |
248 | | SW_DLLPUBLIC rtl::Reference< SwXTextTable > |
249 | | convertToSwTable( |
250 | | css::uno::Sequence< |
251 | | css::uno::Sequence< |
252 | | css::uno::Sequence< |
253 | | css::uno::Reference< |
254 | | css::text::XTextRange > > > > const& |
255 | | rTableRanges, |
256 | | css::uno::Sequence< |
257 | | css::uno::Sequence< |
258 | | css::uno::Sequence< |
259 | | css::beans::PropertyValue > > > const& |
260 | | rCellProperties, |
261 | | css::uno::Sequence< |
262 | | css::uno::Sequence< |
263 | | css::beans::PropertyValue > > const& |
264 | | rRowProperties, |
265 | | css::uno::Sequence< |
266 | | css::beans::PropertyValue > const& |
267 | | rTableProperties); |
268 | | SW_DLLPUBLIC rtl::Reference< SwXTextFrame > |
269 | | convertToSwTextFrame( |
270 | | const css::uno::Reference< css::text::XTextRange >& xStart, |
271 | | const css::uno::Reference< css::text::XTextRange >& xEnd, |
272 | | const std::vector< css::beans::PropertyValue >& xFrameProperties); |
273 | | |
274 | | private: |
275 | | rtl::Reference< SwXTextCursor > getEndImpl(SolarMutexGuard& rGuard); |
276 | | rtl::Reference< SwXTextRange > insertTextPortionImpl( |
277 | | SolarMutexGuard& rGuard, |
278 | | std::u16string_view rText, |
279 | | const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, |
280 | | const rtl::Reference<SwXTextCursor>& xTextCursor); |
281 | | |
282 | | SfxItemPropertySet const& m_rPropSet; |
283 | | const CursorType m_eType; |
284 | | SwDoc * m_pDoc; |
285 | | bool m_bIsValid; |
286 | | }; |
287 | | |
288 | | #endif // INCLUDED_SW_INC_UNOTEXT_HXX |
289 | | |
290 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |