1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SW_UNOTEXTRANGE_HXX
21 #define SW_UNOTEXTRANGE_HXX
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/beans/XPropertyState.hpp>
27 #include <com/sun/star/container/XIndexAccess.hpp>
28 #include <com/sun/star/container/XEnumerationAccess.hpp>
29 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
30 #include <com/sun/star/text/XTextRange.hpp>
31 #include <com/sun/star/text/XRedline.hpp>
33 #include <cppuhelper/implbase3.hxx>
34 #include <cppuhelper/implbase8.hxx>
37 #include <unobaseclass.hxx>
46 class SW_DLLPUBLIC SwUnoInternalPaM
51 SwUnoInternalPaM(const SwUnoInternalPaM
&);
54 SwUnoInternalPaM(SwDoc
& rDoc
);
55 virtual ~SwUnoInternalPaM();
57 SwUnoInternalPaM
& operator=(const SwPaM
& rPaM
);
63 void DeepCopyPaM(SwPaM
const & rSource
, SwPaM
& rTarget
);
65 SW_DLLPUBLIC
bool XTextRangeToSwPaM(SwUnoInternalPaM
& rToFill
,
66 const ::com::sun::star::uno::Reference
<
67 ::com::sun::star::text::XTextRange
> & xTextRange
);
69 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
70 CreateParentXText(SwDoc
& rDoc
, const SwPosition
& rPos
);
72 bool GetDefaultTextContentValue(::com::sun::star::uno::Any
& rAny
,
73 const OUString
& rPropertyName
, sal_uInt16 nWID
= 0);
78 typedef ::cppu::WeakImplHelper8
79 < ::com::sun::star::lang::XUnoTunnel
80 , ::com::sun::star::lang::XServiceInfo
81 , ::com::sun::star::beans::XPropertySet
82 , ::com::sun::star::beans::XPropertyState
83 , ::com::sun::star::container::XEnumerationAccess
84 , ::com::sun::star::container::XContentEnumerationAccess
85 , ::com::sun::star::text::XTextRange
86 , ::com::sun::star::text::XRedline
89 class SW_DLLPUBLIC SwXTextRange
90 : public SwXTextRange_Base
98 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
102 RANGE_IN_TEXT
, // "ordinary" ::com::sun::star::text::TextRange
103 RANGE_IN_CELL
, // position created with a cell that has no uno object
104 RANGE_IS_TABLE
, // anchor of a table
107 void SetPositions(SwPaM
const& rPam
);
108 //TODO: new exception type for protected content
109 void DeleteAndInsert(
110 const OUString
& rText
, const bool bForceExpandHints
)
111 throw (::com::sun::star::uno::RuntimeException
);
114 virtual ~SwXTextRange();
118 SwXTextRange(SwPaM
& rPam
,
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::text::XText
> & xParent
,
121 const enum RangePosition eRange
= RANGE_IN_TEXT
);
122 // only for RANGE_IS_TABLE
123 SwXTextRange(SwFrmFmt
& rTblFmt
);
125 const SwDoc
* GetDoc() const;
127 bool GetPositions(SwPaM
& rToFill
) const;
129 static ::com::sun::star::uno::Reference
<
130 ::com::sun::star::text::XTextRange
> CreateXTextRange(
132 const SwPosition
& rPos
, const SwPosition
*const pMark
);
134 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
137 virtual sal_Int64 SAL_CALL
getSomething(
138 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
139 throw (::com::sun::star::uno::RuntimeException
);
142 virtual OUString SAL_CALL
getImplementationName()
143 throw (::com::sun::star::uno::RuntimeException
);
144 virtual sal_Bool SAL_CALL
supportsService(
145 const OUString
& rServiceName
)
146 throw (::com::sun::star::uno::RuntimeException
);
147 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
148 getSupportedServiceNames()
149 throw (::com::sun::star::uno::RuntimeException
);
152 virtual ::com::sun::star::uno::Reference
<
153 ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
155 throw (::com::sun::star::uno::RuntimeException
);
156 virtual void SAL_CALL
setPropertyValue(
157 const OUString
& rPropertyName
,
158 const ::com::sun::star::uno::Any
& rValue
)
159 throw (::com::sun::star::beans::UnknownPropertyException
,
160 ::com::sun::star::beans::PropertyVetoException
,
161 ::com::sun::star::lang::IllegalArgumentException
,
162 ::com::sun::star::lang::WrappedTargetException
,
163 ::com::sun::star::uno::RuntimeException
);
164 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
165 const OUString
& rPropertyName
)
166 throw (::com::sun::star::beans::UnknownPropertyException
,
167 ::com::sun::star::lang::WrappedTargetException
,
168 ::com::sun::star::uno::RuntimeException
);
169 virtual void SAL_CALL
addPropertyChangeListener(
170 const OUString
& rPropertyName
,
171 const ::com::sun::star::uno::Reference
<
172 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
173 throw (::com::sun::star::beans::UnknownPropertyException
,
174 ::com::sun::star::lang::WrappedTargetException
,
175 ::com::sun::star::uno::RuntimeException
);
176 virtual void SAL_CALL
removePropertyChangeListener(
177 const OUString
& rPropertyName
,
178 const ::com::sun::star::uno::Reference
<
179 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
180 throw (::com::sun::star::beans::UnknownPropertyException
,
181 ::com::sun::star::lang::WrappedTargetException
,
182 ::com::sun::star::uno::RuntimeException
);
183 virtual void SAL_CALL
addVetoableChangeListener(
184 const OUString
& rPropertyName
,
185 const ::com::sun::star::uno::Reference
<
186 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
187 throw (::com::sun::star::beans::UnknownPropertyException
,
188 ::com::sun::star::lang::WrappedTargetException
,
189 ::com::sun::star::uno::RuntimeException
);
190 virtual void SAL_CALL
removeVetoableChangeListener(
191 const OUString
& rPropertyName
,
192 const ::com::sun::star::uno::Reference
<
193 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
194 throw (::com::sun::star::beans::UnknownPropertyException
,
195 ::com::sun::star::lang::WrappedTargetException
,
196 ::com::sun::star::uno::RuntimeException
);
199 virtual ::com::sun::star::beans::PropertyState SAL_CALL
200 getPropertyState(const OUString
& rPropertyName
)
201 throw (::com::sun::star::beans::UnknownPropertyException
,
202 ::com::sun::star::uno::RuntimeException
);
203 virtual ::com::sun::star::uno::Sequence
<
204 ::com::sun::star::beans::PropertyState
> SAL_CALL
206 const ::com::sun::star::uno::Sequence
<
207 OUString
>& rPropertyNames
)
208 throw (::com::sun::star::beans::UnknownPropertyException
,
209 ::com::sun::star::uno::RuntimeException
);
210 virtual void SAL_CALL
setPropertyToDefault(
211 const OUString
& rPropertyName
)
212 throw (::com::sun::star::beans::UnknownPropertyException
,
213 ::com::sun::star::uno::RuntimeException
);
214 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
215 const OUString
& rPropertyName
)
216 throw (::com::sun::star::beans::UnknownPropertyException
,
217 ::com::sun::star::lang::WrappedTargetException
,
218 ::com::sun::star::uno::RuntimeException
);
221 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
222 throw (::com::sun::star::uno::RuntimeException
);
223 virtual sal_Bool SAL_CALL
hasElements()
224 throw (::com::sun::star::uno::RuntimeException
);
226 // XEnumerationAccess
227 virtual ::com::sun::star::uno::Reference
<
228 ::com::sun::star::container::XEnumeration
> SAL_CALL
230 throw (::com::sun::star::uno::RuntimeException
);
232 // XContentEnumerationAccess
233 virtual ::com::sun::star::uno::Reference
<
234 ::com::sun::star::container::XEnumeration
> SAL_CALL
235 createContentEnumeration(const OUString
& rServiceName
)
236 throw (::com::sun::star::uno::RuntimeException
);
237 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
238 getAvailableServiceNames()
239 throw (::com::sun::star::uno::RuntimeException
);
242 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
244 throw (::com::sun::star::uno::RuntimeException
);
245 virtual ::com::sun::star::uno::Reference
<
246 ::com::sun::star::text::XTextRange
> SAL_CALL
getStart()
247 throw (::com::sun::star::uno::RuntimeException
);
248 virtual ::com::sun::star::uno::Reference
<
249 ::com::sun::star::text::XTextRange
> SAL_CALL
getEnd()
250 throw (::com::sun::star::uno::RuntimeException
);
251 virtual OUString SAL_CALL
getString()
252 throw (::com::sun::star::uno::RuntimeException
);
253 virtual void SAL_CALL
setString(const OUString
& rString
)
254 throw (::com::sun::star::uno::RuntimeException
);
257 virtual void SAL_CALL
makeRedline(
258 const OUString
& rRedlineType
,
259 const ::com::sun::star::uno::Sequence
<
260 ::com::sun::star::beans::PropertyValue
>& RedlineProperties
)
261 throw (::com::sun::star::lang::IllegalArgumentException
,
262 ::com::sun::star::uno::RuntimeException
);
266 typedef ::cppu::WeakImplHelper3
267 < ::com::sun::star::lang::XUnoTunnel
268 , ::com::sun::star::lang::XServiceInfo
269 , ::com::sun::star::container::XIndexAccess
270 > SwXTextRanges_Base
;
273 : public SwXTextRanges_Base
279 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
281 virtual ~SwXTextRanges();
285 SwXTextRanges(SwPaM
*const pCrsr
);
287 const SwUnoCrsr
* GetCursor() const;
289 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
292 virtual sal_Int64 SAL_CALL
getSomething(
293 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
294 throw (::com::sun::star::uno::RuntimeException
);
297 virtual OUString SAL_CALL
getImplementationName()
298 throw (::com::sun::star::uno::RuntimeException
);
299 virtual sal_Bool SAL_CALL
supportsService(
300 const OUString
& rServiceName
)
301 throw (::com::sun::star::uno::RuntimeException
);
302 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
303 getSupportedServiceNames()
304 throw (::com::sun::star::uno::RuntimeException
);
307 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
308 throw (::com::sun::star::uno::RuntimeException
);
309 virtual sal_Bool SAL_CALL
hasElements()
310 throw (::com::sun::star::uno::RuntimeException
);
313 virtual sal_Int32 SAL_CALL
getCount()
314 throw (::com::sun::star::uno::RuntimeException
);
315 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
)
316 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
317 ::com::sun::star::lang::WrappedTargetException
,
318 ::com::sun::star::uno::RuntimeException
);
322 #endif // SW_UNOTEXTRANGE_HXX
324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */