Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / unoparagraph.hxx
blob5bca49d1912b6bc6ef4b0794c99e1ce555406daa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_UNOPARAGRAPH_HXX
21 #define INCLUDED_SW_INC_UNOPARAGRAPH_HXX
23 #include <memory>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <com/sun/star/beans/XMultiPropertySet.hpp>
30 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
31 #include <com/sun/star/container/XEnumerationAccess.hpp>
32 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
33 #include <com/sun/star/text/XTextContent.hpp>
34 #include <com/sun/star/text/XTextRange.hpp>
36 #include <cppuhelper/implbase10.hxx>
38 #include <sfx2/Metadatable.hxx>
40 #include <unobaseclass.hxx>
42 struct SwPosition;
43 class SwPaM;
44 class SwUnoCrsr;
45 class SwStartNode;
46 class SwTextNode;
47 class SwTable;
48 class SwXText;
50 typedef ::cppu::ImplInheritanceHelper10
51 < ::sfx2::MetadatableMixin
52 , ::com::sun::star::lang::XUnoTunnel
53 , ::com::sun::star::lang::XServiceInfo
54 , ::com::sun::star::beans::XPropertySet
55 , ::com::sun::star::beans::XPropertyState
56 , ::com::sun::star::beans::XMultiPropertySet
57 , ::com::sun::star::beans::XTolerantMultiPropertySet
58 , ::com::sun::star::container::XEnumerationAccess
59 , ::com::sun::star::container::XContentEnumerationAccess
60 , ::com::sun::star::text::XTextContent
61 , ::com::sun::star::text::XTextRange
62 > SwXParagraph_Base;
64 class SwXParagraph
65 : public SwXParagraph_Base
68 private:
70 class Impl;
71 ::sw::UnoImplPtr<Impl> m_pImpl;
73 virtual ~SwXParagraph();
75 SwXParagraph(::com::sun::star::uno::Reference<
76 ::com::sun::star::text::XText > const & xParent,
77 SwTextNode & rTextNode,
78 const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
80 /// descriptor
81 SwXParagraph();
83 public:
85 static ::com::sun::star::uno::Reference<
86 ::com::sun::star::text::XTextContent>
87 CreateXParagraph(SwDoc & rDoc, SwTextNode * pTextNode,
88 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText>
89 const& xParentText = 0,
90 const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
92 const SwTextNode * GetTextNode() const;
93 bool IsDescriptor() const;
94 /// make rPaM select the paragraph
95 bool SelectPaM(SwPaM & rPaM);
96 /// for SwXText
97 void attachToText(SwXText & rParent, SwTextNode & rTextNode);
99 // MetadatableMixin
100 virtual ::sfx2::Metadatable* GetCoreObject() SAL_OVERRIDE;
101 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
102 GetModel() SAL_OVERRIDE;
104 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
106 // XUnoTunnel
107 virtual sal_Int64 SAL_CALL getSomething(
108 const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
109 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 // XServiceInfo
112 virtual OUString SAL_CALL getImplementationName()
113 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 virtual sal_Bool SAL_CALL supportsService(
115 const OUString& rServiceName)
116 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
118 getSupportedServiceNames()
119 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 // XComponent
122 virtual void SAL_CALL dispose()
123 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 virtual void SAL_CALL addEventListener(
125 const ::com::sun::star::uno::Reference<
126 ::com::sun::star::lang::XEventListener > & xListener)
127 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL removeEventListener(
129 const ::com::sun::star::uno::Reference<
130 ::com::sun::star::lang::XEventListener > & xListener)
131 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 // XPropertySet
134 virtual ::com::sun::star::uno::Reference<
135 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
136 getPropertySetInfo()
137 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 virtual void SAL_CALL setPropertyValue(
139 const OUString& rPropertyName,
140 const ::com::sun::star::uno::Any& rValue)
141 throw (::com::sun::star::beans::UnknownPropertyException,
142 ::com::sun::star::beans::PropertyVetoException,
143 ::com::sun::star::lang::IllegalArgumentException,
144 ::com::sun::star::lang::WrappedTargetException,
145 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
147 const OUString& rPropertyName)
148 throw (::com::sun::star::beans::UnknownPropertyException,
149 ::com::sun::star::lang::WrappedTargetException,
150 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 virtual void SAL_CALL addPropertyChangeListener(
152 const OUString& rPropertyName,
153 const ::com::sun::star::uno::Reference<
154 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
155 throw (::com::sun::star::beans::UnknownPropertyException,
156 ::com::sun::star::lang::WrappedTargetException,
157 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 virtual void SAL_CALL removePropertyChangeListener(
159 const OUString& rPropertyName,
160 const ::com::sun::star::uno::Reference<
161 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
162 throw (::com::sun::star::beans::UnknownPropertyException,
163 ::com::sun::star::lang::WrappedTargetException,
164 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 virtual void SAL_CALL addVetoableChangeListener(
166 const OUString& rPropertyName,
167 const ::com::sun::star::uno::Reference<
168 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
169 throw (::com::sun::star::beans::UnknownPropertyException,
170 ::com::sun::star::lang::WrappedTargetException,
171 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 virtual void SAL_CALL removeVetoableChangeListener(
173 const OUString& rPropertyName,
174 const ::com::sun::star::uno::Reference<
175 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
176 throw (::com::sun::star::beans::UnknownPropertyException,
177 ::com::sun::star::lang::WrappedTargetException,
178 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 // XPropertyState
181 virtual ::com::sun::star::beans::PropertyState SAL_CALL
182 getPropertyState(const OUString& rPropertyName)
183 throw (::com::sun::star::beans::UnknownPropertyException,
184 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 virtual ::com::sun::star::uno::Sequence<
186 ::com::sun::star::beans::PropertyState > SAL_CALL
187 getPropertyStates(
188 const ::com::sun::star::uno::Sequence<
189 OUString >& rPropertyNames)
190 throw (::com::sun::star::beans::UnknownPropertyException,
191 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
192 virtual void SAL_CALL setPropertyToDefault(
193 const OUString& rPropertyName)
194 throw (::com::sun::star::beans::UnknownPropertyException,
195 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
196 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
197 const OUString& rPropertyName)
198 throw (::com::sun::star::beans::UnknownPropertyException,
199 ::com::sun::star::lang::WrappedTargetException,
200 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 // XMultiPropertySet
203 virtual void SAL_CALL setPropertyValues(
204 const ::com::sun::star::uno::Sequence< OUString >&
205 rPropertyNames,
206 const ::com::sun::star::uno::Sequence<
207 ::com::sun::star::uno::Any >& rValues)
208 throw (::com::sun::star::beans::PropertyVetoException,
209 ::com::sun::star::lang::IllegalArgumentException,
210 ::com::sun::star::lang::WrappedTargetException,
211 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
212 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
213 SAL_CALL getPropertyValues(
214 const ::com::sun::star::uno::Sequence< OUString >&
215 rPropertyNames)
216 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
217 virtual void SAL_CALL addPropertiesChangeListener(
218 const ::com::sun::star::uno::Sequence< OUString >&
219 rPropertyNames,
220 const ::com::sun::star::uno::Reference<
221 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
222 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
223 virtual void SAL_CALL removePropertiesChangeListener(
224 const ::com::sun::star::uno::Reference<
225 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
226 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
227 virtual void SAL_CALL firePropertiesChangeEvent(
228 const ::com::sun::star::uno::Sequence< OUString >&
229 rPropertyNames,
230 const ::com::sun::star::uno::Reference<
231 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
232 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
234 // XTolerantMultiPropertySet
235 virtual ::com::sun::star::uno::Sequence<
236 ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL
237 setPropertyValuesTolerant(
238 const ::com::sun::star::uno::Sequence< OUString >&
239 rPropertyNames,
240 const ::com::sun::star::uno::Sequence<
241 ::com::sun::star::uno::Any >& rValues)
242 throw (::com::sun::star::lang::IllegalArgumentException,
243 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
244 virtual ::com::sun::star::uno::Sequence<
245 ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL
246 getPropertyValuesTolerant(
247 const ::com::sun::star::uno::Sequence< OUString >&
248 rPropertyNames)
249 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
250 virtual ::com::sun::star::uno::Sequence<
251 ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL
252 getDirectPropertyValuesTolerant(
253 const ::com::sun::star::uno::Sequence< OUString >&
254 rPropertyNames)
255 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
257 // XElementAccess
258 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
259 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 virtual sal_Bool SAL_CALL hasElements()
261 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
263 // XEnumerationAccess
264 virtual ::com::sun::star::uno::Reference<
265 ::com::sun::star::container::XEnumeration > SAL_CALL
266 createEnumeration()
267 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
269 // XContentEnumerationAccess
270 virtual ::com::sun::star::uno::Reference<
271 ::com::sun::star::container::XEnumeration > SAL_CALL
272 createContentEnumeration(const OUString& rServiceName)
273 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
274 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
275 getAvailableServiceNames()
276 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
278 // XTextContent
279 virtual void SAL_CALL attach(
280 const ::com::sun::star::uno::Reference<
281 ::com::sun::star::text::XTextRange > & xTextRange)
282 throw (::com::sun::star::lang::IllegalArgumentException,
283 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
284 virtual ::com::sun::star::uno::Reference<
285 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
286 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
288 // XTextRange
289 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
290 SAL_CALL getText()
291 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
292 virtual ::com::sun::star::uno::Reference<
293 ::com::sun::star::text::XTextRange > SAL_CALL getStart()
294 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
295 virtual ::com::sun::star::uno::Reference<
296 ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
297 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
298 virtual OUString SAL_CALL getString()
299 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
300 virtual void SAL_CALL setString(const OUString& rString)
301 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
305 class SwXParagraphEnumeration
306 : public SwSimpleEnumeration_Base
309 private:
311 class Impl;
312 ::sw::UnoImplPtr<Impl> m_pImpl;
314 virtual ~SwXParagraphEnumeration();
316 public:
318 /// takes ownership of cursor
319 SwXParagraphEnumeration(
320 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
321 const & xParent,
322 ::std::unique_ptr<SwUnoCrsr> && pCursor,
323 const CursorType eType,
324 SwStartNode const*const pStartNode = 0,
325 SwTable const*const pTable = 0);
327 // XServiceInfo
328 virtual OUString SAL_CALL getImplementationName()
329 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
330 virtual sal_Bool SAL_CALL supportsService(
331 const OUString& rServiceName)
332 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
333 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
334 getSupportedServiceNames()
335 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
337 // XEnumeration
338 virtual sal_Bool SAL_CALL hasMoreElements()
339 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
340 virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
341 throw (::com::sun::star::container::NoSuchElementException,
342 ::com::sun::star::lang::WrappedTargetException,
343 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
347 #endif // INCLUDED_SW_INC_UNOPARAGRAPH_HXX
349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */