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;
43
44class SAL_DLLPUBLIC_RTTI 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
54private:
55
56 class Impl;
58
59 virtual void PrepareForAttach(
60 css::uno::Reference< css::text::XTextRange > & xRange,
61 SwPaM const & rPam);
64 virtual bool CheckForOwnMemberMeta(
65 const SwPaM & rPam, const bool bAbsorb);
66
67protected:
68
69 bool IsValid() const;
70 void Invalidate();
71 void SetDoc(SwDoc *const pDoc);
72
73 virtual ~SwXText();
74
75public: /*not protected because C++ is retarded*/
76 virtual const SwStartNode *GetStartNode() const;
77
78public:
79
80 SwXText(SwDoc *const pDoc, const CursorType eType);
81
82 const SwDoc* GetDoc() const;
83 SwDoc* GetDoc();
84
86 virtual css::uno::Reference< css::text::XTextCursor >
87 CreateCursor();
88
89 // XInterface
90 virtual css::uno::Any SAL_CALL queryInterface(
91 const css::uno::Type& rType) override;
92
93 // XTypeProvider
94 virtual css::uno::Sequence< css::uno::Type >
95 SAL_CALL getTypes() override;
96
97 // XPropertySet
98 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
99 getPropertySetInfo() override;
100 virtual void SAL_CALL setPropertyValue(
101 const OUString& rPropertyName,
102 const css::uno::Any& rValue) override;
103 virtual css::uno::Any SAL_CALL getPropertyValue(
104 const OUString& rPropertyName) override;
105 virtual void SAL_CALL addPropertyChangeListener(
106 const OUString& rPropertyName,
107 const css::uno::Reference<
108 css::beans::XPropertyChangeListener >& xListener) override;
109 virtual void SAL_CALL removePropertyChangeListener(
110 const OUString& rPropertyName,
111 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
112 virtual void SAL_CALL addVetoableChangeListener(
113 const OUString& rPropertyName,
114 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
115 virtual void SAL_CALL removeVetoableChangeListener(
116 const OUString& rPropertyName,
117 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
118
119 // XTextRange
120 virtual css::uno::Reference< css::text::XText >
121 SAL_CALL getText() override;
122 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
123 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
124 virtual OUString SAL_CALL getString() override;
125 virtual void SAL_CALL setString(const OUString& rString) override;
126
127 // XSimpleText
128 virtual void SAL_CALL insertString(
129 const css::uno::Reference< css::text::XTextRange > & xRange,
130 const OUString& aString, sal_Bool bAbsorb) override;
131 virtual void SAL_CALL insertControlCharacter(
132 const css::uno::Reference< css::text::XTextRange > & xRange,
133 sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
134
135 // XText
136 virtual void SAL_CALL insertTextContent(
137 const css::uno::Reference< css::text::XTextRange > & xRange,
138 const css::uno::Reference< css::text::XTextContent > & xContent,
139 sal_Bool bAbsorb) override;
140 virtual void SAL_CALL removeTextContent(
141 const css::uno::Reference< css::text::XTextContent > & xContent) override;
142
143 // XParagraphAppend
144 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
145 finishParagraph(
146 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
147 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
148 finishParagraphInsert(
149 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
150 const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
151
152 // XTextPortionAppend
153 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
154 appendTextPortion(
155 const OUString& rText,
156 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
157
158 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
159 insertTextPortion(
160 const OUString& rText,
161 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
162 const css::uno::Reference< css::text::XTextRange >& rTextRange) override;
163
164 // XTextContentAppend
165 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
166 appendTextContent(
167 const css::uno::Reference< css::text::XTextContent >& xTextContent,
168 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
169 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
170 insertTextContentWithProperties(
171 const css::uno::Reference< css::text::XTextContent >& xTextContent,
172 const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
173 const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
174
175 // XTextConvert
176 virtual css::uno::Reference< css::text::XTextContent > SAL_CALL
177 convertToTextFrame(
178 const css::uno::Reference< css::text::XTextRange >& xStart,
179 const css::uno::Reference< css::text::XTextRange >& xEnd,
180 const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override;
181 virtual css::uno::Reference<
182 css::text::XTextTable > SAL_CALL
183 convertToTable(
184 css::uno::Sequence<
185 css::uno::Sequence<
186 css::uno::Sequence<
187 css::uno::Reference<
188 css::text::XTextRange > > > > const&
189 rTableRanges,
190 css::uno::Sequence<
191 css::uno::Sequence<
192 css::uno::Sequence<
193 css::beans::PropertyValue > > > const&
194 rCellProperties,
195 css::uno::Sequence<
196 css::uno::Sequence<
197 css::beans::PropertyValue > > const&
198 rRowProperties,
199 css::uno::Sequence<
200 css::beans::PropertyValue > const&
201 rTableProperties) override;
202
203 // XTextCopy
204 virtual void SAL_CALL copyText(
205 const css::uno::Reference< css::text::XTextCopy >& xSource ) override;
206
207 // XTextRangeCompare
208 sal_Int16 SAL_CALL compareRegionStarts(
209 const css::uno::Reference< css::text::XTextRange >& xR1,
210 const css::uno::Reference< css::text::XTextRange >& xR2) override;
211 sal_Int16 SAL_CALL compareRegionEnds(
212 const css::uno::Reference< css::text::XTextRange >& xR1,
213 const css::uno::Reference< css::text::XTextRange >& xR2) override;
214
215 // XRelativeTextContentInsert
216 virtual void SAL_CALL insertTextContentBefore(
217 const css::uno::Reference< css::text::XTextContent>& xNewContent,
218 const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
219 virtual void SAL_CALL insertTextContentAfter(
220 const css::uno::Reference< css::text::XTextContent>& xNewContent,
221 const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
222
223 // XRelativeTextContentRemove
224 virtual void SAL_CALL removeTextContentBefore(
225 const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
226 virtual void SAL_CALL removeTextContentAfter(
227 const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
228};
229
230#endif // INCLUDED_SW_INC_UNOTEXT_HXX
231
232/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:195
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
Starts a section of nodes in the document model.
Definition: node.hxx:348
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unotext.hxx:56
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