1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SW_UNOTEXTRANGE_HXX
29 #define SW_UNOTEXTRANGE_HXX
31 #include <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/beans/XPropertyState.hpp>
35 #include <com/sun/star/container/XIndexAccess.hpp>
36 #include <com/sun/star/container/XEnumerationAccess.hpp>
37 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
38 #include <com/sun/star/text/XTextRange.hpp>
39 #include <com/sun/star/text/XRedline.hpp>
41 #include <cppuhelper/implbase3.hxx>
42 #include <cppuhelper/implbase8.hxx>
45 #include <unobaseclass.hxx>
54 /* -----------------29.04.98 07:35-------------------
56 * --------------------------------------------------*/
57 class SwUnoInternalPaM
62 SwUnoInternalPaM(const SwUnoInternalPaM
&);
65 SwUnoInternalPaM(SwDoc
& rDoc
);
66 virtual ~SwUnoInternalPaM();
68 SwUnoInternalPaM
& operator=(const SwPaM
& rPaM
);
74 void DeepCopyPaM(SwPaM
const & rSource
, SwPaM
& rTarget
);
76 bool XTextRangeToSwPaM(SwUnoInternalPaM
& rToFill
,
77 const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::text::XTextRange
> & xTextRange
);
80 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
81 CreateParentXText(SwDoc
& rDoc
, const SwPosition
& rPos
);
83 bool GetDefaultTextContentValue(::com::sun::star::uno::Any
& rAny
,
84 const ::rtl::OUString
& rPropertyName
, USHORT nWID
= 0);
89 typedef ::cppu::WeakImplHelper8
90 < ::com::sun::star::lang::XUnoTunnel
91 , ::com::sun::star::lang::XServiceInfo
92 , ::com::sun::star::beans::XPropertySet
93 , ::com::sun::star::beans::XPropertyState
94 , ::com::sun::star::container::XEnumerationAccess
95 , ::com::sun::star::container::XContentEnumerationAccess
96 , ::com::sun::star::text::XTextRange
97 , ::com::sun::star::text::XRedline
100 class SW_DLLPUBLIC SwXTextRange
101 : public SwXTextRange_Base
106 friend class SwXText
;
109 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
113 RANGE_IN_TEXT
, // "ordinary" ::com::sun::star::text::TextRange
114 RANGE_IN_CELL
, // position created with a cell that has no uno object
115 RANGE_IS_TABLE
, // anchor of a table
118 void SetPositions(SwPaM
const& rPam
);
119 //TODO: new exception type for protected content
120 void DeleteAndInsert(
121 const ::rtl::OUString
& rText
, const bool bForceExpandHints
)
122 throw (::com::sun::star::uno::RuntimeException
);
125 virtual ~SwXTextRange();
129 SwXTextRange(SwPaM
& rPam
,
130 const ::com::sun::star::uno::Reference
<
131 ::com::sun::star::text::XText
> & xParent
,
132 const enum RangePosition eRange
= RANGE_IN_TEXT
);
133 // only for RANGE_IS_TABLE
134 SwXTextRange(SwFrmFmt
& rTblFmt
);
136 const SwDoc
* GetDoc() const;
138 bool GetPositions(SwPaM
& rToFill
) const;
140 static ::com::sun::star::uno::Reference
<
141 ::com::sun::star::text::XTextRange
> CreateXTextRange(
143 const SwPosition
& rPos
, const SwPosition
*const pMark
);
145 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
148 virtual sal_Int64 SAL_CALL
getSomething(
149 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
150 throw (::com::sun::star::uno::RuntimeException
);
153 virtual ::rtl::OUString SAL_CALL
getImplementationName()
154 throw (::com::sun::star::uno::RuntimeException
);
155 virtual sal_Bool SAL_CALL
supportsService(
156 const ::rtl::OUString
& rServiceName
)
157 throw (::com::sun::star::uno::RuntimeException
);
158 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
159 getSupportedServiceNames()
160 throw (::com::sun::star::uno::RuntimeException
);
163 virtual ::com::sun::star::uno::Reference
<
164 ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
166 throw (::com::sun::star::uno::RuntimeException
);
167 virtual void SAL_CALL
setPropertyValue(
168 const ::rtl::OUString
& rPropertyName
,
169 const ::com::sun::star::uno::Any
& rValue
)
170 throw (::com::sun::star::beans::UnknownPropertyException
,
171 ::com::sun::star::beans::PropertyVetoException
,
172 ::com::sun::star::lang::IllegalArgumentException
,
173 ::com::sun::star::lang::WrappedTargetException
,
174 ::com::sun::star::uno::RuntimeException
);
175 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
176 const ::rtl::OUString
& rPropertyName
)
177 throw (::com::sun::star::beans::UnknownPropertyException
,
178 ::com::sun::star::lang::WrappedTargetException
,
179 ::com::sun::star::uno::RuntimeException
);
180 virtual void SAL_CALL
addPropertyChangeListener(
181 const ::rtl::OUString
& rPropertyName
,
182 const ::com::sun::star::uno::Reference
<
183 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
184 throw (::com::sun::star::beans::UnknownPropertyException
,
185 ::com::sun::star::lang::WrappedTargetException
,
186 ::com::sun::star::uno::RuntimeException
);
187 virtual void SAL_CALL
removePropertyChangeListener(
188 const ::rtl::OUString
& rPropertyName
,
189 const ::com::sun::star::uno::Reference
<
190 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
191 throw (::com::sun::star::beans::UnknownPropertyException
,
192 ::com::sun::star::lang::WrappedTargetException
,
193 ::com::sun::star::uno::RuntimeException
);
194 virtual void SAL_CALL
addVetoableChangeListener(
195 const ::rtl::OUString
& rPropertyName
,
196 const ::com::sun::star::uno::Reference
<
197 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
198 throw (::com::sun::star::beans::UnknownPropertyException
,
199 ::com::sun::star::lang::WrappedTargetException
,
200 ::com::sun::star::uno::RuntimeException
);
201 virtual void SAL_CALL
removeVetoableChangeListener(
202 const ::rtl::OUString
& rPropertyName
,
203 const ::com::sun::star::uno::Reference
<
204 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
205 throw (::com::sun::star::beans::UnknownPropertyException
,
206 ::com::sun::star::lang::WrappedTargetException
,
207 ::com::sun::star::uno::RuntimeException
);
210 virtual ::com::sun::star::beans::PropertyState SAL_CALL
211 getPropertyState(const ::rtl::OUString
& rPropertyName
)
212 throw (::com::sun::star::beans::UnknownPropertyException
,
213 ::com::sun::star::uno::RuntimeException
);
214 virtual ::com::sun::star::uno::Sequence
<
215 ::com::sun::star::beans::PropertyState
> SAL_CALL
217 const ::com::sun::star::uno::Sequence
<
218 ::rtl::OUString
>& rPropertyNames
)
219 throw (::com::sun::star::beans::UnknownPropertyException
,
220 ::com::sun::star::uno::RuntimeException
);
221 virtual void SAL_CALL
setPropertyToDefault(
222 const ::rtl::OUString
& rPropertyName
)
223 throw (::com::sun::star::beans::UnknownPropertyException
,
224 ::com::sun::star::uno::RuntimeException
);
225 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
226 const ::rtl::OUString
& rPropertyName
)
227 throw (::com::sun::star::beans::UnknownPropertyException
,
228 ::com::sun::star::lang::WrappedTargetException
,
229 ::com::sun::star::uno::RuntimeException
);
232 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
233 throw (::com::sun::star::uno::RuntimeException
);
234 virtual sal_Bool SAL_CALL
hasElements()
235 throw (::com::sun::star::uno::RuntimeException
);
237 // XEnumerationAccess
238 virtual ::com::sun::star::uno::Reference
<
239 ::com::sun::star::container::XEnumeration
> SAL_CALL
241 throw (::com::sun::star::uno::RuntimeException
);
243 // XContentEnumerationAccess
244 virtual ::com::sun::star::uno::Reference
<
245 ::com::sun::star::container::XEnumeration
> SAL_CALL
246 createContentEnumeration(const ::rtl::OUString
& rServiceName
)
247 throw (::com::sun::star::uno::RuntimeException
);
248 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
249 getAvailableServiceNames()
250 throw (::com::sun::star::uno::RuntimeException
);
253 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
255 throw (::com::sun::star::uno::RuntimeException
);
256 virtual ::com::sun::star::uno::Reference
<
257 ::com::sun::star::text::XTextRange
> SAL_CALL
getStart()
258 throw (::com::sun::star::uno::RuntimeException
);
259 virtual ::com::sun::star::uno::Reference
<
260 ::com::sun::star::text::XTextRange
> SAL_CALL
getEnd()
261 throw (::com::sun::star::uno::RuntimeException
);
262 virtual ::rtl::OUString SAL_CALL
getString()
263 throw (::com::sun::star::uno::RuntimeException
);
264 virtual void SAL_CALL
setString(const ::rtl::OUString
& rString
)
265 throw (::com::sun::star::uno::RuntimeException
);
268 virtual void SAL_CALL
makeRedline(
269 const ::rtl::OUString
& rRedlineType
,
270 const ::com::sun::star::uno::Sequence
<
271 ::com::sun::star::beans::PropertyValue
>& RedlineProperties
)
272 throw (::com::sun::star::lang::IllegalArgumentException
,
273 ::com::sun::star::uno::RuntimeException
);
277 /* -----------------15.05.98 08:29-------------------
279 * --------------------------------------------------*/
281 typedef ::cppu::WeakImplHelper3
282 < ::com::sun::star::lang::XUnoTunnel
283 , ::com::sun::star::lang::XServiceInfo
284 , ::com::sun::star::container::XIndexAccess
285 > SwXTextRanges_Base
;
288 : public SwXTextRanges_Base
294 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
296 virtual ~SwXTextRanges();
300 SwXTextRanges(SwPaM
*const pCrsr
);
302 const SwUnoCrsr
* GetCursor() const;
304 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
307 virtual sal_Int64 SAL_CALL
getSomething(
308 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
309 throw (::com::sun::star::uno::RuntimeException
);
312 virtual ::rtl::OUString SAL_CALL
getImplementationName()
313 throw (::com::sun::star::uno::RuntimeException
);
314 virtual sal_Bool SAL_CALL
supportsService(
315 const ::rtl::OUString
& rServiceName
)
316 throw (::com::sun::star::uno::RuntimeException
);
317 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
318 getSupportedServiceNames()
319 throw (::com::sun::star::uno::RuntimeException
);
322 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
323 throw (::com::sun::star::uno::RuntimeException
);
324 virtual sal_Bool SAL_CALL
hasElements()
325 throw (::com::sun::star::uno::RuntimeException
);
328 virtual sal_Int32 SAL_CALL
getCount()
329 throw (::com::sun::star::uno::RuntimeException
);
330 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
)
331 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
332 ::com::sun::star::lang::WrappedTargetException
,
333 ::com::sun::star::uno::RuntimeException
);
337 #endif // SW_UNOTEXTRANGE_HXX