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 INCLUDED_SW_INC_UNOTEXTRANGE_HXX
21 #define INCLUDED_SW_INC_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/implbase.hxx>
36 #include <unobaseclass.hxx>
42 class SW_DLLPUBLIC SwUnoInternalPaM
47 SwUnoInternalPaM(const SwUnoInternalPaM
&) SAL_DELETED_FUNCTION
;
50 SwUnoInternalPaM(SwDoc
& rDoc
);
51 virtual ~SwUnoInternalPaM();
53 SwUnoInternalPaM
& operator=(const SwPaM
& rPaM
);
58 void DeepCopyPaM(SwPaM
const & rSource
, SwPaM
& rTarget
);
60 SW_DLLPUBLIC
bool XTextRangeToSwPaM(SwUnoInternalPaM
& rToFill
,
61 const ::com::sun::star::uno::Reference
<
62 ::com::sun::star::text::XTextRange
> & xTextRange
);
64 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
65 CreateParentXText(SwDoc
& rDoc
, const SwPosition
& rPos
);
67 bool GetDefaultTextContentValue(::com::sun::star::uno::Any
& rAny
,
68 const OUString
& rPropertyName
, sal_uInt16 nWID
= 0);
72 typedef ::cppu::WeakImplHelper
73 < ::com::sun::star::lang::XUnoTunnel
74 , ::com::sun::star::lang::XServiceInfo
75 , ::com::sun::star::beans::XPropertySet
76 , ::com::sun::star::beans::XPropertyState
77 , ::com::sun::star::container::XEnumerationAccess
78 , ::com::sun::star::container::XContentEnumerationAccess
79 , ::com::sun::star::text::XTextRange
80 , ::com::sun::star::text::XRedline
83 class SW_DLLPUBLIC SwXTextRange
84 : public SwXTextRange_Base
92 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
96 RANGE_IN_TEXT
, // "ordinary" ::com::sun::star::text::TextRange
97 RANGE_IN_CELL
, // position created with a cell that has no uno object
98 RANGE_IS_TABLE
, // anchor of a table
101 void SetPositions(SwPaM
const& rPam
);
102 //TODO: new exception type for protected content
103 void DeleteAndInsert(
104 const OUString
& rText
, const bool bForceExpandHints
)
105 throw (::com::sun::star::uno::RuntimeException
);
108 virtual ~SwXTextRange();
112 SwXTextRange(SwPaM
& rPam
,
113 const ::com::sun::star::uno::Reference
<
114 ::com::sun::star::text::XText
> & xParent
,
115 const enum RangePosition eRange
= RANGE_IN_TEXT
);
116 // only for RANGE_IS_TABLE
117 SwXTextRange(SwFrameFormat
& rTableFormat
);
119 const SwDoc
* GetDoc() const;
121 bool GetPositions(SwPaM
& rToFill
) const;
123 static ::com::sun::star::uno::Reference
<
124 ::com::sun::star::text::XTextRange
> CreateXTextRange(
126 const SwPosition
& rPos
, const SwPosition
*const pMark
);
128 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
131 virtual sal_Int64 SAL_CALL
getSomething(
132 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
133 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual OUString SAL_CALL
getImplementationName()
137 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
138 virtual sal_Bool SAL_CALL
supportsService(
139 const OUString
& rServiceName
)
140 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
142 getSupportedServiceNames()
143 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual ::com::sun::star::uno::Reference
<
147 ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
149 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 virtual void SAL_CALL
setPropertyValue(
151 const OUString
& rPropertyName
,
152 const ::com::sun::star::uno::Any
& rValue
)
153 throw (::com::sun::star::beans::UnknownPropertyException
,
154 ::com::sun::star::beans::PropertyVetoException
,
155 ::com::sun::star::lang::IllegalArgumentException
,
156 ::com::sun::star::lang::WrappedTargetException
,
157 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
158 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
159 const OUString
& rPropertyName
)
160 throw (::com::sun::star::beans::UnknownPropertyException
,
161 ::com::sun::star::lang::WrappedTargetException
,
162 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 virtual void SAL_CALL
addPropertyChangeListener(
164 const OUString
& rPropertyName
,
165 const ::com::sun::star::uno::Reference
<
166 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
167 throw (::com::sun::star::beans::UnknownPropertyException
,
168 ::com::sun::star::lang::WrappedTargetException
,
169 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
170 virtual void SAL_CALL
removePropertyChangeListener(
171 const OUString
& rPropertyName
,
172 const ::com::sun::star::uno::Reference
<
173 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
174 throw (::com::sun::star::beans::UnknownPropertyException
,
175 ::com::sun::star::lang::WrappedTargetException
,
176 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 virtual void SAL_CALL
addVetoableChangeListener(
178 const OUString
& rPropertyName
,
179 const ::com::sun::star::uno::Reference
<
180 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
181 throw (::com::sun::star::beans::UnknownPropertyException
,
182 ::com::sun::star::lang::WrappedTargetException
,
183 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 virtual void SAL_CALL
removeVetoableChangeListener(
185 const OUString
& rPropertyName
,
186 const ::com::sun::star::uno::Reference
<
187 ::com::sun::star::beans::XVetoableChangeListener
>& xListener
)
188 throw (::com::sun::star::beans::UnknownPropertyException
,
189 ::com::sun::star::lang::WrappedTargetException
,
190 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 virtual ::com::sun::star::beans::PropertyState SAL_CALL
194 getPropertyState(const OUString
& rPropertyName
)
195 throw (::com::sun::star::beans::UnknownPropertyException
,
196 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual ::com::sun::star::uno::Sequence
<
198 ::com::sun::star::beans::PropertyState
> SAL_CALL
200 const ::com::sun::star::uno::Sequence
<
201 OUString
>& rPropertyNames
)
202 throw (::com::sun::star::beans::UnknownPropertyException
,
203 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 virtual void SAL_CALL
setPropertyToDefault(
205 const OUString
& rPropertyName
)
206 throw (::com::sun::star::beans::UnknownPropertyException
,
207 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
208 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
209 const OUString
& rPropertyName
)
210 throw (::com::sun::star::beans::UnknownPropertyException
,
211 ::com::sun::star::lang::WrappedTargetException
,
212 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
215 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
216 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
217 virtual sal_Bool SAL_CALL
hasElements()
218 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
220 // XEnumerationAccess
221 virtual ::com::sun::star::uno::Reference
<
222 ::com::sun::star::container::XEnumeration
> SAL_CALL
224 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 // XContentEnumerationAccess
227 virtual ::com::sun::star::uno::Reference
<
228 ::com::sun::star::container::XEnumeration
> SAL_CALL
229 createContentEnumeration(const OUString
& rServiceName
)
230 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
231 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
232 getAvailableServiceNames()
233 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
236 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
>
238 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
239 virtual ::com::sun::star::uno::Reference
<
240 ::com::sun::star::text::XTextRange
> SAL_CALL
getStart()
241 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
242 virtual ::com::sun::star::uno::Reference
<
243 ::com::sun::star::text::XTextRange
> SAL_CALL
getEnd()
244 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 virtual OUString SAL_CALL
getString()
246 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
247 virtual void SAL_CALL
setString(const OUString
& rString
)
248 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 virtual void SAL_CALL
makeRedline(
252 const OUString
& rRedlineType
,
253 const ::com::sun::star::uno::Sequence
<
254 ::com::sun::star::beans::PropertyValue
>& RedlineProperties
)
255 throw (::com::sun::star::lang::IllegalArgumentException
,
256 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
260 typedef ::cppu::WeakImplHelper
261 < ::com::sun::star::lang::XUnoTunnel
262 , ::com::sun::star::lang::XServiceInfo
263 , ::com::sun::star::container::XIndexAccess
264 > SwXTextRanges_Base
;
267 : public SwXTextRanges_Base
273 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
275 virtual ~SwXTextRanges();
279 SwXTextRanges(SwPaM
*const pCrsr
);
281 const SwUnoCrsr
* GetCursor() const;
283 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
286 virtual sal_Int64 SAL_CALL
getSomething(
287 const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
)
288 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
291 virtual OUString SAL_CALL
getImplementationName()
292 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
293 virtual sal_Bool SAL_CALL
supportsService(
294 const OUString
& rServiceName
)
295 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
296 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
297 getSupportedServiceNames()
298 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
301 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
302 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
303 virtual sal_Bool SAL_CALL
hasElements()
304 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
307 virtual sal_Int32 SAL_CALL
getCount()
308 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
309 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
)
310 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
311 ::com::sun::star::lang::WrappedTargetException
,
312 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
316 #endif // INCLUDED_SW_INC_UNOTEXTRANGE_HXX
318 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */