xref: /trunk/main/sw/inc/unoparagraph.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_UNOPARAGRAPH_HXX
25 #define SW_UNOPARAGRAPH_HXX
26 
27 #include <memory>
28 
29 #include <com/sun/star/lang/XUnoTunnel.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/beans/XPropertyState.hpp>
33 #include <com/sun/star/beans/XMultiPropertySet.hpp>
34 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
35 #include <com/sun/star/container/XEnumerationAccess.hpp>
36 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
37 #include <com/sun/star/text/XTextContent.hpp>
38 #include <com/sun/star/text/XTextRange.hpp>
39 
40 #include <cppuhelper/implbase10.hxx>
41 
42 #include <sfx2/Metadatable.hxx>
43 
44 #include <unobaseclass.hxx>
45 
46 
47 struct SwPosition;
48 class SwPaM;
49 class SwUnoCrsr;
50 class SwStartNode;
51 class SwTxtNode;
52 class SwTable;
53 class SwXText;
54 
55 
56 /*-----------------07.04.98 08:15-------------------
57 
58 --------------------------------------------------*/
59 typedef ::cppu::ImplInheritanceHelper10
60 <   ::sfx2::MetadatableMixin
61 ,   ::com::sun::star::lang::XUnoTunnel
62 ,   ::com::sun::star::lang::XServiceInfo
63 ,   ::com::sun::star::beans::XPropertySet
64 ,   ::com::sun::star::beans::XPropertyState
65 ,   ::com::sun::star::beans::XMultiPropertySet
66 ,   ::com::sun::star::beans::XTolerantMultiPropertySet
67 ,   ::com::sun::star::container::XEnumerationAccess
68 ,   ::com::sun::star::container::XContentEnumerationAccess
69 ,   ::com::sun::star::text::XTextContent
70 ,   ::com::sun::star::text::XTextRange
71 > SwXParagraph_Base;
72 
73 class SwXParagraph
74     : public SwXParagraph_Base
75 {
76 
77 private:
78 
79     class Impl;
80     ::sw::UnoImplPtr<Impl> m_pImpl;
81 
82     virtual ~SwXParagraph();
83 
84     SwXParagraph(::com::sun::star::uno::Reference<
85                     ::com::sun::star::text::XText > const & xParent,
86             SwTxtNode & rTxtNode,
87             const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
88 
89 public:
90 
91     /// descriptor
92     SwXParagraph();
93 
94     static ::com::sun::star::uno::Reference<
95             ::com::sun::star::text::XTextContent>
96         CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode,
97             ::com::sun::star::uno::Reference< ::com::sun::star::text::XText>
98                 const& xParentText = 0,
99             const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1);
100 
101     const SwTxtNode * GetTxtNode() const;
102     bool            IsDescriptor() const;
103     /// make rPaM select the paragraph
104     bool SelectPaM(SwPaM & rPaM);
105     /// for SwXText
106     void attachToText(SwXText & rParent, SwTxtNode & rTxtNode);
107 
108     // MetadatableMixin
109     virtual ::sfx2::Metadatable* GetCoreObject();
110     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
111         GetModel();
112 
113     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
114 
115     // XUnoTunnel
116     virtual sal_Int64 SAL_CALL getSomething(
117             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
118         throw (::com::sun::star::uno::RuntimeException);
119 
120     // XServiceInfo
121     virtual ::rtl::OUString SAL_CALL getImplementationName()
122         throw (::com::sun::star::uno::RuntimeException);
123     virtual sal_Bool SAL_CALL supportsService(
124             const ::rtl::OUString& rServiceName)
125         throw (::com::sun::star::uno::RuntimeException);
126     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
127         getSupportedServiceNames()
128         throw (::com::sun::star::uno::RuntimeException);
129 
130     // XComponent
131     virtual void SAL_CALL dispose()
132         throw (::com::sun::star::uno::RuntimeException);
133     virtual void SAL_CALL addEventListener(
134             const ::com::sun::star::uno::Reference<
135                 ::com::sun::star::lang::XEventListener > & xListener)
136         throw (::com::sun::star::uno::RuntimeException);
137     virtual void SAL_CALL removeEventListener(
138             const ::com::sun::star::uno::Reference<
139                 ::com::sun::star::lang::XEventListener > & xListener)
140         throw (::com::sun::star::uno::RuntimeException);
141 
142     // XPropertySet
143     virtual ::com::sun::star::uno::Reference<
144                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
145         getPropertySetInfo()
146         throw (::com::sun::star::uno::RuntimeException);
147     virtual void SAL_CALL setPropertyValue(
148             const ::rtl::OUString& rPropertyName,
149             const ::com::sun::star::uno::Any& rValue)
150         throw (::com::sun::star::beans::UnknownPropertyException,
151                 ::com::sun::star::beans::PropertyVetoException,
152                 ::com::sun::star::lang::IllegalArgumentException,
153                 ::com::sun::star::lang::WrappedTargetException,
154                 ::com::sun::star::uno::RuntimeException);
155     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
156             const ::rtl::OUString& rPropertyName)
157         throw (::com::sun::star::beans::UnknownPropertyException,
158                 ::com::sun::star::lang::WrappedTargetException,
159                 ::com::sun::star::uno::RuntimeException);
160     virtual void SAL_CALL addPropertyChangeListener(
161             const ::rtl::OUString& rPropertyName,
162             const ::com::sun::star::uno::Reference<
163                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
164         throw (::com::sun::star::beans::UnknownPropertyException,
165                 ::com::sun::star::lang::WrappedTargetException,
166                 ::com::sun::star::uno::RuntimeException);
167     virtual void SAL_CALL removePropertyChangeListener(
168             const ::rtl::OUString& rPropertyName,
169             const ::com::sun::star::uno::Reference<
170                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
171         throw (::com::sun::star::beans::UnknownPropertyException,
172                 ::com::sun::star::lang::WrappedTargetException,
173                 ::com::sun::star::uno::RuntimeException);
174     virtual void SAL_CALL addVetoableChangeListener(
175             const ::rtl::OUString& rPropertyName,
176             const ::com::sun::star::uno::Reference<
177                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
178         throw (::com::sun::star::beans::UnknownPropertyException,
179                 ::com::sun::star::lang::WrappedTargetException,
180                 ::com::sun::star::uno::RuntimeException);
181     virtual void SAL_CALL removeVetoableChangeListener(
182             const ::rtl::OUString& rPropertyName,
183             const ::com::sun::star::uno::Reference<
184                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
185         throw (::com::sun::star::beans::UnknownPropertyException,
186                 ::com::sun::star::lang::WrappedTargetException,
187                 ::com::sun::star::uno::RuntimeException);
188 
189     // XPropertyState
190     virtual ::com::sun::star::beans::PropertyState SAL_CALL
191         getPropertyState(const ::rtl::OUString& rPropertyName)
192         throw (::com::sun::star::beans::UnknownPropertyException,
193                 ::com::sun::star::uno::RuntimeException);
194     virtual ::com::sun::star::uno::Sequence<
195             ::com::sun::star::beans::PropertyState > SAL_CALL
196         getPropertyStates(
197             const ::com::sun::star::uno::Sequence<
198                 ::rtl::OUString >& rPropertyNames)
199         throw (::com::sun::star::beans::UnknownPropertyException,
200                 ::com::sun::star::uno::RuntimeException);
201     virtual void SAL_CALL setPropertyToDefault(
202             const ::rtl::OUString& rPropertyName)
203         throw (::com::sun::star::beans::UnknownPropertyException,
204                 ::com::sun::star::uno::RuntimeException);
205     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
206             const ::rtl::OUString& rPropertyName)
207         throw (::com::sun::star::beans::UnknownPropertyException,
208                 ::com::sun::star::lang::WrappedTargetException,
209                 ::com::sun::star::uno::RuntimeException);
210 
211     // XMultiPropertySet
212     virtual void SAL_CALL setPropertyValues(
213             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
214                 rPropertyNames,
215             const ::com::sun::star::uno::Sequence<
216                 ::com::sun::star::uno::Any >& rValues)
217         throw (::com::sun::star::beans::PropertyVetoException,
218                 ::com::sun::star::lang::IllegalArgumentException,
219                 ::com::sun::star::lang::WrappedTargetException,
220                 ::com::sun::star::uno::RuntimeException);
221     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
222         SAL_CALL getPropertyValues(
223             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
224                 rPropertyNames)
225         throw (::com::sun::star::uno::RuntimeException);
226     virtual void SAL_CALL addPropertiesChangeListener(
227             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
228                 rPropertyNames,
229             const ::com::sun::star::uno::Reference<
230                 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
231         throw (::com::sun::star::uno::RuntimeException);
232     virtual void SAL_CALL removePropertiesChangeListener(
233             const ::com::sun::star::uno::Reference<
234                 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
235         throw (::com::sun::star::uno::RuntimeException);
236     virtual void SAL_CALL firePropertiesChangeEvent(
237             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
238                 rPropertyNames,
239             const ::com::sun::star::uno::Reference<
240                 ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
241         throw (::com::sun::star::uno::RuntimeException);
242 
243     // XTolerantMultiPropertySet
244     virtual ::com::sun::star::uno::Sequence<
245                 ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL
246         setPropertyValuesTolerant(
247             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
248                 rPropertyNames,
249             const ::com::sun::star::uno::Sequence<
250                 ::com::sun::star::uno::Any >& rValues)
251         throw (::com::sun::star::lang::IllegalArgumentException,
252                 ::com::sun::star::uno::RuntimeException);
253     virtual ::com::sun::star::uno::Sequence<
254                 ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL
255         getPropertyValuesTolerant(
256             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
257                 rPropertyNames)
258         throw (::com::sun::star::uno::RuntimeException);
259     virtual ::com::sun::star::uno::Sequence<
260             ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL
261         getDirectPropertyValuesTolerant(
262             const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
263                 rPropertyNames)
264         throw (::com::sun::star::uno::RuntimeException);
265 
266     // XElementAccess
267     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
268         throw (::com::sun::star::uno::RuntimeException);
269     virtual sal_Bool SAL_CALL hasElements()
270         throw (::com::sun::star::uno::RuntimeException);
271 
272     // XEnumerationAccess
273     virtual ::com::sun::star::uno::Reference<
274             ::com::sun::star::container::XEnumeration >  SAL_CALL
275         createEnumeration()
276         throw (::com::sun::star::uno::RuntimeException);
277 
278     // XContentEnumerationAccess
279     virtual ::com::sun::star::uno::Reference<
280                 ::com::sun::star::container::XEnumeration > SAL_CALL
281         createContentEnumeration(const ::rtl::OUString& rServiceName)
282         throw (::com::sun::star::uno::RuntimeException);
283     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
284         getAvailableServiceNames()
285         throw (::com::sun::star::uno::RuntimeException);
286 
287     // XTextContent
288     virtual void SAL_CALL attach(
289             const ::com::sun::star::uno::Reference<
290                 ::com::sun::star::text::XTextRange > & xTextRange)
291         throw (::com::sun::star::lang::IllegalArgumentException,
292                 ::com::sun::star::uno::RuntimeException);
293     virtual ::com::sun::star::uno::Reference<
294                 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
295         throw (::com::sun::star::uno::RuntimeException);
296 
297     // XTextRange
298     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
299         SAL_CALL getText()
300         throw (::com::sun::star::uno::RuntimeException);
301     virtual ::com::sun::star::uno::Reference<
302                 ::com::sun::star::text::XTextRange > SAL_CALL getStart()
303         throw (::com::sun::star::uno::RuntimeException);
304     virtual ::com::sun::star::uno::Reference<
305                 ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
306         throw (::com::sun::star::uno::RuntimeException);
307     virtual ::rtl::OUString SAL_CALL getString()
308         throw (::com::sun::star::uno::RuntimeException);
309     virtual void SAL_CALL setString(const ::rtl::OUString& rString)
310         throw (::com::sun::star::uno::RuntimeException);
311 
312 };
313 
314 
315 /*-----------------07.04.98 08:10-------------------
316 
317 --------------------------------------------------*/
318 class SwXParagraphEnumeration
319     : public SwSimpleEnumeration_Base
320 {
321 
322 private:
323 
324     class Impl;
325     ::sw::UnoImplPtr<Impl> m_pImpl;
326 
327     virtual ~SwXParagraphEnumeration();
328 
329 public:
330 
331     /// takes ownership of cursor
332     SwXParagraphEnumeration(
333             ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
334                 const & xParent,
335             ::std::auto_ptr<SwUnoCrsr> pCursor,
336             const CursorType eType,
337             SwStartNode const*const pStartNode = 0,
338             SwTable const*const pTable = 0);
339 
340     // XServiceInfo
341     virtual ::rtl::OUString SAL_CALL getImplementationName()
342         throw (::com::sun::star::uno::RuntimeException);
343     virtual sal_Bool SAL_CALL supportsService(
344             const ::rtl::OUString& rServiceName)
345         throw (::com::sun::star::uno::RuntimeException);
346     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
347         getSupportedServiceNames()
348         throw (::com::sun::star::uno::RuntimeException);
349 
350     // XEnumeration
351     virtual sal_Bool SAL_CALL hasMoreElements()
352         throw (::com::sun::star::uno::RuntimeException);
353     virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
354         throw (::com::sun::star::container::NoSuchElementException,
355                 ::com::sun::star::lang::WrappedTargetException,
356                 ::com::sun::star::uno::RuntimeException);
357 
358 };
359 
360 #endif // SW_UNOPARAGRAPH_HXX
361 
362