LibreOffice Module sw (master) 1
unotext.hxx
Go to the documentation of this file.
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 <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/text/XTextCopy.hpp>
25#include <com/sun/star/text/XTextRangeCompare.hpp>
26#include <com/sun/star/text/XRelativeTextContentInsert.hpp>
27#include <com/sun/star/text/XRelativeTextContentRemove.hpp>
28#include <com/sun/star/text/XTextAppendAndConvert.hpp>
29#include <sal/types.h>
30
31#include "unobaseclass.hxx"
32
33namespace com::sun::star {
34 namespace text {
35 class XTextContent;
36 class XText;
37 }
38}
39
40class SwDoc;
41class SwStartNode;
42class SwPaM;
43class SwXTextCursor;
44
45class SAL_DLLPUBLIC_RTTI 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
55private:
56
57 class Impl;
59
60 virtual void PrepareForAttach(
61 css::uno::Reference< css::text::XTextRange > & xRange,
62 SwPaM const & rPam);
65 virtual bool CheckForOwnMemberMeta(
66 const SwPaM & rPam, const bool bAbsorb);
67
68protected:
69
70 bool IsValid() const;
71 void Invalidate();
72 void SetDoc(SwDoc *const pDoc);
73
74 virtual ~SwXText();
75
76public: /*not protected because C++ is retarded*/
77 virtual const SwStartNode *GetStartNode() const;
78
79public:
80
81 SwXText(SwDoc *const pDoc, const CursorType eType);
82
83 const SwDoc* GetDoc() const;
84 SwDoc* GetDoc();
85
86 // XInterface
87 virtual css::uno::Any SAL_CALL queryInterface(
88 const css::uno::Type& rType) override;
89
90 // XTypeProvider
91 virtual css::uno::Sequence< css::uno::Type >
92 SAL_CALL getTypes() override;
93
94 // XPropertySet
95 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
96 getPropertySetInfo() override;
97 virtual void SAL_CALL setPropertyValue(
98 const OUString& rPropertyName,
99 const css::uno::Any& rValue) override;
100 virtual css::uno::Any SAL_CALL getPropertyValue(
101 const OUString& rPropertyName) override;
102 virtual void SAL_CALL addPropertyChangeListener(
103 const OUString& rPropertyName,
104 const css::uno::Reference<
105 css::beans::XPropertyChangeListener >& xListener) override;
106 virtual void SAL_CALL removePropertyChangeListener(
107 const OUString& rPropertyName,
108 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
109 virtual void SAL_CALL addVetoableChangeListener(
110 const OUString& rPropertyName,
111 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
112 virtual void SAL_CALL removeVetoableChangeListener(
113 const OUString& rPropertyName,
114 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
115
116 // XTextRange
117 virtual css::uno::Reference< css::text::XText >
118 SAL_CALL getText() override;
119 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
120 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
121 virtual OUString SAL_CALL getString() override;
122 virtual void SAL_CALL setString(const OUString& rString) override;
123
124 // XSimpleText
125 virtual void SAL_CALL insertString(
126 const css::uno::Reference< css::text::XTextRange > & xRange,
127 const OUString& aString, sal_Bool bAbsorb) override;
128 virtual void SAL_CALL insertControlCharacter(
129 const css::uno::Reference< css::text::XTextRange > & xRange,
130 sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
131 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(
132 const ::css::uno::Reference< ::css::text::XTextRange >& aTextPosition ) override final;
134 const ::css::uno::Reference< ::css::text::XTextRange >& aTextPosition ) = 0;
135 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override final;
136 virtual rtl::Reference< SwXTextCursor > createXTextCursor() = 0;
137
138 // XText
139 virtual void SAL_CALL insertTextContent(
140 const css::uno::Reference< css::text::XTextRange > & xRange,
141 const css::uno::Reference< css::text::XTextContent > & xContent,
142 sal_Bool bAbsorb) override;
143 virtual void SAL_CALL removeTextContent(
144 const css::uno::Reference< css::text::XTextContent > & xContent) override;
145
146 // XParagraphAppend
147 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
148 finishParagraph(
149 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
150 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
151 finishParagraphInsert(
152 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
153 const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
154
155 // XTextPortionAppend
156 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
157 appendTextPortion(
158 const OUString& rText,
159 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
160
161 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
162 insertTextPortion(
163 const OUString& rText,
164 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
165 const css::uno::Reference< css::text::XTextRange >& rTextRange) override;
166
167 // XTextContentAppend
168 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
169 appendTextContent(
170 const css::uno::Reference< css::text::XTextContent >& xTextContent,
171 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
172 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
173 insertTextContentWithProperties(
174 const css::uno::Reference< css::text::XTextContent >& xTextContent,
175 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
176 const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
177
178 // XTextConvert
179 virtual css::uno::Reference< css::text::XTextContent > SAL_CALL
180 convertToTextFrame(
181 const css::uno::Reference< css::text::XTextRange >& xStart,
182 const css::uno::Reference< css::text::XTextRange >& xEnd,
183 const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override;
184 virtual css::uno::Reference<
185 css::text::XTextTable > SAL_CALL
186 convertToTable(
187 css::uno::Sequence<
188 css::uno::Sequence<
189 css::uno::Sequence<
190 css::uno::Reference<
191 css::text::XTextRange > > > > const&
192 rTableRanges,
193 css::uno::Sequence<
194 css::uno::Sequence<
195 css::uno::Sequence<
196 css::beans::PropertyValue > > > const&
197 rCellProperties,
198 css::uno::Sequence<
199 css::uno::Sequence<
200 css::beans::PropertyValue > > const&
201 rRowProperties,
202 css::uno::Sequence<
203 css::beans::PropertyValue > const&
204 rTableProperties) override;
205
206 // XTextCopy
207 virtual void SAL_CALL copyText(
208 const css::uno::Reference< css::text::XTextCopy >& xSource ) override;
209
210 // XTextRangeCompare
211 sal_Int16 SAL_CALL compareRegionStarts(
212 const css::uno::Reference< css::text::XTextRange >& xR1,
213 const css::uno::Reference< css::text::XTextRange >& xR2) override;
214 sal_Int16 SAL_CALL compareRegionEnds(
215 const css::uno::Reference< css::text::XTextRange >& xR1,
216 const css::uno::Reference< css::text::XTextRange >& xR2) override;
217
218 // XRelativeTextContentInsert
219 virtual void SAL_CALL insertTextContentBefore(
220 const css::uno::Reference< css::text::XTextContent>& xNewContent,
221 const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
222 virtual void SAL_CALL insertTextContentAfter(
223 const css::uno::Reference< css::text::XTextContent>& xNewContent,
224 const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
225
226 // XRelativeTextContentRemove
227 virtual void SAL_CALL removeTextContentBefore(
228 const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
229 virtual void SAL_CALL removeTextContentAfter(
230 const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
231};
232
233#endif // INCLUDED_SW_INC_UNOTEXT_HXX
234
235/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
Starts a section of nodes in the document model.
Definition: node.hxx:348
virtual rtl::Reference< SwXTextCursor > createXTextCursorByRange(const ::css::uno::Reference< ::css::text::XTextRange > &aTextPosition)=0
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unotext.hxx:57
static SwNode * GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
def text(shape, orig_st)
OUString getString(const Any &_rAny)
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
unsigned char sal_Bool
CursorType