Debian Codegraph @

sw/inc/unotext.hxx

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