tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / sw / inc / unotext.hxx
bloba229c4db593120429cfb0d7ec59b7dc6afe4dd0e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
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>
32 #include "unobaseclass.hxx"
34 namespace com::sun::star {
35 namespace text {
36 class XTextContent;
37 class XText;
41 class SfxItemPropertySet;
42 class SwDoc;
43 class SwStartNode;
44 class SwNodeRange;
45 class SwPaM;
46 class SwXTextCursor;
47 class SwXParagraph;
48 class SwXTextRange;
49 class SwXTextTable;
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
61 private:
63 virtual void PrepareForAttach(
64 css::uno::Reference< css::text::XTextRange > & xRange,
65 SwPaM const & rPam);
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);
77 void ConvertCell(
78 const css::uno::Sequence< css::uno::Reference< css::text::XTextRange > > & rCell,
79 std::vector<SwNodeRange> & rRowNodes,
80 SwNodeRange *const pLastCell);
82 protected:
84 bool IsValid() const { return m_bIsValid; }
85 void Invalidate() { m_bIsValid = false; }
86 void SetDoc(SwDoc *const pDoc);
88 virtual ~SwXText();
90 public: /*not protected because C++ is retarded*/
91 virtual const SwStartNode *GetStartNode() const;
93 public:
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;
104 // XInterface
105 virtual css::uno::Any SAL_CALL queryInterface(
106 const css::uno::Type& rType) override;
108 // XTypeProvider
109 virtual css::uno::Sequence< css::uno::Type >
110 SAL_CALL getTypes() override;
112 // XPropertySet
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;
134 // XTextRange
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;
142 // XSimpleText
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;
156 // XText
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;
164 // XParagraphAppend
165 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
166 finishParagraph(
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
175 appendTextPortion(
176 const OUString& rText,
177 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
179 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
180 insertTextPortion(
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
187 appendTextContent(
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;
196 // XTextConvert
197 virtual css::uno::Reference< css::text::XTextContent > SAL_CALL
198 convertToTextFrame(
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
204 convertToTable(
205 css::uno::Sequence<
206 css::uno::Sequence<
207 css::uno::Sequence<
208 css::uno::Reference<
209 css::text::XTextRange > > > > const&
210 rTableRanges,
211 css::uno::Sequence<
212 css::uno::Sequence<
213 css::uno::Sequence<
214 css::beans::PropertyValue > > > const&
215 rCellProperties,
216 css::uno::Sequence<
217 css::uno::Sequence<
218 css::beans::PropertyValue > > const&
219 rRowProperties,
220 css::uno::Sequence<
221 css::beans::PropertyValue > const&
222 rTableProperties) override;
224 // XTextCopy
225 SW_DLLPUBLIC virtual void SAL_CALL copyText(
226 const css::uno::Reference< css::text::XTextCopy >& xSource ) override;
228 // XTextRangeCompare
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 >
251 convertToSwTable(
252 css::uno::Sequence<
253 css::uno::Sequence<
254 css::uno::Sequence<
255 css::uno::Reference<
256 css::text::XTextRange > > > > const&
257 rTableRanges,
258 css::uno::Sequence<
259 css::uno::Sequence<
260 css::uno::Sequence<
261 css::beans::PropertyValue > > > const&
262 rCellProperties,
263 css::uno::Sequence<
264 css::uno::Sequence<
265 css::beans::PropertyValue > > const&
266 rRowProperties,
267 css::uno::Sequence<
268 css::beans::PropertyValue > const&
269 rTableProperties);
271 private:
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;
281 SwDoc * m_pDoc;
282 bool m_bIsValid;
285 #endif // INCLUDED_SW_INC_UNOTEXT_HXX
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */