xref: /aoo41x/main/sw/inc/unoidx.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 #ifndef _UNOIDX_HXX
28 #define _UNOIDX_HXX
29 
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/container/XNamed.hpp>
33 #include <com/sun/star/text/XDocumentIndexMark.hpp>
34 #include <com/sun/star/text/XDocumentIndex.hpp>
35 
36 #include <cppuhelper/implbase4.hxx>
37 #include <cppuhelper/implbase5.hxx>
38 
39 #include <sfx2/Metadatable.hxx>
40 
41 #include <unocoll.hxx>
42 #include <toxe.hxx>
43 
44 
45 class SwTOXBaseSection;
46 class SwTOXMark;
47 class SwTOXType;
48 
49 /* -----------------07.12.98 10:08-------------------
50  *
51  * --------------------------------------------------*/
52 
53 typedef ::cppu::ImplInheritanceHelper5
54 <   ::sfx2::MetadatableMixin
55 ,   ::com::sun::star::lang::XUnoTunnel
56 ,   ::com::sun::star::lang::XServiceInfo
57 ,   ::com::sun::star::beans::XPropertySet
58 ,   ::com::sun::star::container::XNamed
59 ,   ::com::sun::star::text::XDocumentIndex
60 > SwXDocumentIndex_Base;
61 
62 class SwXDocumentIndex
63     : public SwXDocumentIndex_Base
64 {
65 
66 private:
67 
68     class StyleAccess_Impl;
69     class TokenAccess_Impl;
70 
71     class Impl;
72     ::sw::UnoImplPtr<Impl> m_pImpl;
73 
74 	virtual ~SwXDocumentIndex();
75 
76     SwXDocumentIndex(SwTOXBaseSection const&, SwDoc &);
77 
78 public:
79 
80     /// descriptor
81     SwXDocumentIndex(const TOXTypes eToxType, SwDoc& rDoc);
82 
83     static ::com::sun::star::uno::Reference<
84             ::com::sun::star::text::XDocumentIndex>
85         CreateXDocumentIndex(SwDoc & rDoc, SwTOXBaseSection const& rSection);
86 
87     // MetadatableMixin
88     virtual ::sfx2::Metadatable* GetCoreObject();
89     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
90         GetModel();
91 
92 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
93 
94     // XUnoTunnel
95     virtual sal_Int64 SAL_CALL getSomething(
96             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
97         throw (::com::sun::star::uno::RuntimeException);
98 
99     // XServiceInfo
100     virtual ::rtl::OUString SAL_CALL getImplementationName()
101         throw (::com::sun::star::uno::RuntimeException);
102     virtual sal_Bool SAL_CALL supportsService(
103             const ::rtl::OUString& rServiceName)
104         throw (::com::sun::star::uno::RuntimeException);
105     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
106         getSupportedServiceNames()
107         throw (::com::sun::star::uno::RuntimeException);
108 
109     // XComponent
110     virtual void SAL_CALL dispose()
111         throw (::com::sun::star::uno::RuntimeException);
112     virtual void SAL_CALL addEventListener(
113             const ::com::sun::star::uno::Reference<
114                 ::com::sun::star::lang::XEventListener > & xListener)
115         throw (::com::sun::star::uno::RuntimeException);
116     virtual void SAL_CALL removeEventListener(
117             const ::com::sun::star::uno::Reference<
118                 ::com::sun::star::lang::XEventListener > & xListener)
119         throw (::com::sun::star::uno::RuntimeException);
120 
121     // XPropertySet
122     virtual ::com::sun::star::uno::Reference<
123                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
124         getPropertySetInfo()
125         throw (::com::sun::star::uno::RuntimeException);
126     virtual void SAL_CALL setPropertyValue(
127             const ::rtl::OUString& rPropertyName,
128             const ::com::sun::star::uno::Any& rValue)
129         throw (::com::sun::star::beans::UnknownPropertyException,
130                 ::com::sun::star::beans::PropertyVetoException,
131                 ::com::sun::star::lang::IllegalArgumentException,
132                 ::com::sun::star::lang::WrappedTargetException,
133                 ::com::sun::star::uno::RuntimeException);
134     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
135             const ::rtl::OUString& rPropertyName)
136         throw (::com::sun::star::beans::UnknownPropertyException,
137                 ::com::sun::star::lang::WrappedTargetException,
138                 ::com::sun::star::uno::RuntimeException);
139     virtual void SAL_CALL addPropertyChangeListener(
140             const ::rtl::OUString& rPropertyName,
141             const ::com::sun::star::uno::Reference<
142                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
143         throw (::com::sun::star::beans::UnknownPropertyException,
144                 ::com::sun::star::lang::WrappedTargetException,
145                 ::com::sun::star::uno::RuntimeException);
146     virtual void SAL_CALL removePropertyChangeListener(
147             const ::rtl::OUString& rPropertyName,
148             const ::com::sun::star::uno::Reference<
149                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
150         throw (::com::sun::star::beans::UnknownPropertyException,
151                 ::com::sun::star::lang::WrappedTargetException,
152                 ::com::sun::star::uno::RuntimeException);
153     virtual void SAL_CALL addVetoableChangeListener(
154             const ::rtl::OUString& rPropertyName,
155             const ::com::sun::star::uno::Reference<
156                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
157         throw (::com::sun::star::beans::UnknownPropertyException,
158                 ::com::sun::star::lang::WrappedTargetException,
159                 ::com::sun::star::uno::RuntimeException);
160     virtual void SAL_CALL removeVetoableChangeListener(
161             const ::rtl::OUString& rPropertyName,
162             const ::com::sun::star::uno::Reference<
163                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
164         throw (::com::sun::star::beans::UnknownPropertyException,
165                 ::com::sun::star::lang::WrappedTargetException,
166                 ::com::sun::star::uno::RuntimeException);
167 
168     // XNamed
169     virtual ::rtl::OUString SAL_CALL getName()
170         throw (::com::sun::star::uno::RuntimeException);
171     virtual void SAL_CALL setName(const ::rtl::OUString& rName)
172         throw (::com::sun::star::uno::RuntimeException);
173 
174     // XTextContent
175     virtual void SAL_CALL attach(
176             const ::com::sun::star::uno::Reference<
177                 ::com::sun::star::text::XTextRange > & xTextRange)
178         throw (::com::sun::star::lang::IllegalArgumentException,
179                 ::com::sun::star::uno::RuntimeException);
180     virtual ::com::sun::star::uno::Reference<
181                 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
182         throw (::com::sun::star::uno::RuntimeException);
183 
184 
185     // XDocumentIndex
186     virtual ::rtl::OUString SAL_CALL getServiceName()
187         throw (::com::sun::star::uno::RuntimeException);
188     virtual void SAL_CALL update()
189         throw (::com::sun::star::uno::RuntimeException);
190 
191 };
192 
193 /* -----------------07.12.98 10:08-------------------
194  *
195  * --------------------------------------------------*/
196 typedef ::cppu::WeakImplHelper4
197 <   ::com::sun::star::lang::XUnoTunnel
198 ,   ::com::sun::star::lang::XServiceInfo
199 ,   ::com::sun::star::beans::XPropertySet
200 ,   ::com::sun::star::text::XDocumentIndexMark
201 > SwXDocumentIndexMark_Base;
202 
203 class SwXDocumentIndexMark
204     : public SwXDocumentIndexMark_Base
205 {
206 
207 private:
208 
209     class Impl;
210     ::sw::UnoImplPtr<Impl> m_pImpl;
211 
212 	virtual ~SwXDocumentIndexMark();
213 
214     SwXDocumentIndexMark(SwDoc & rDoc,
215                 SwTOXType & rType, SwTOXMark & rMark);
216 
217 public:
218 
219     /// descriptor
220     SwXDocumentIndexMark(const TOXTypes eToxType);
221 
222     static ::com::sun::star::uno::Reference<
223             ::com::sun::star::text::XDocumentIndexMark>
224         CreateXDocumentIndexMark(SwDoc & rDoc,
225                 SwTOXType & rType, SwTOXMark & rMark);
226 
227 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
228 
229     // XUnoTunnel
230     virtual sal_Int64 SAL_CALL getSomething(
231             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
232         throw (::com::sun::star::uno::RuntimeException);
233 
234     // XServiceInfo
235     virtual ::rtl::OUString SAL_CALL getImplementationName()
236         throw (::com::sun::star::uno::RuntimeException);
237     virtual sal_Bool SAL_CALL supportsService(
238             const ::rtl::OUString& rServiceName)
239         throw (::com::sun::star::uno::RuntimeException);
240     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
241         getSupportedServiceNames()
242         throw (::com::sun::star::uno::RuntimeException);
243 
244     // XComponent
245     virtual void SAL_CALL dispose()
246         throw (::com::sun::star::uno::RuntimeException);
247     virtual void SAL_CALL addEventListener(
248             const ::com::sun::star::uno::Reference<
249                 ::com::sun::star::lang::XEventListener > & xListener)
250         throw (::com::sun::star::uno::RuntimeException);
251     virtual void SAL_CALL removeEventListener(
252             const ::com::sun::star::uno::Reference<
253                 ::com::sun::star::lang::XEventListener > & xListener)
254         throw (::com::sun::star::uno::RuntimeException);
255 
256     // XPropertySet
257     virtual ::com::sun::star::uno::Reference<
258                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
259         getPropertySetInfo()
260         throw (::com::sun::star::uno::RuntimeException);
261     virtual void SAL_CALL setPropertyValue(
262             const ::rtl::OUString& rPropertyName,
263             const ::com::sun::star::uno::Any& rValue)
264         throw (::com::sun::star::beans::UnknownPropertyException,
265                 ::com::sun::star::beans::PropertyVetoException,
266                 ::com::sun::star::lang::IllegalArgumentException,
267                 ::com::sun::star::lang::WrappedTargetException,
268                 ::com::sun::star::uno::RuntimeException);
269     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
270             const ::rtl::OUString& rPropertyName)
271         throw (::com::sun::star::beans::UnknownPropertyException,
272                 ::com::sun::star::lang::WrappedTargetException,
273                 ::com::sun::star::uno::RuntimeException);
274     virtual void SAL_CALL addPropertyChangeListener(
275             const ::rtl::OUString& rPropertyName,
276             const ::com::sun::star::uno::Reference<
277                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
278         throw (::com::sun::star::beans::UnknownPropertyException,
279                 ::com::sun::star::lang::WrappedTargetException,
280                 ::com::sun::star::uno::RuntimeException);
281     virtual void SAL_CALL removePropertyChangeListener(
282             const ::rtl::OUString& rPropertyName,
283             const ::com::sun::star::uno::Reference<
284                 ::com::sun::star::beans::XPropertyChangeListener >& xListener)
285         throw (::com::sun::star::beans::UnknownPropertyException,
286                 ::com::sun::star::lang::WrappedTargetException,
287                 ::com::sun::star::uno::RuntimeException);
288     virtual void SAL_CALL addVetoableChangeListener(
289             const ::rtl::OUString& rPropertyName,
290             const ::com::sun::star::uno::Reference<
291                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
292         throw (::com::sun::star::beans::UnknownPropertyException,
293                 ::com::sun::star::lang::WrappedTargetException,
294                 ::com::sun::star::uno::RuntimeException);
295     virtual void SAL_CALL removeVetoableChangeListener(
296             const ::rtl::OUString& rPropertyName,
297             const ::com::sun::star::uno::Reference<
298                 ::com::sun::star::beans::XVetoableChangeListener >& xListener)
299         throw (::com::sun::star::beans::UnknownPropertyException,
300                 ::com::sun::star::lang::WrappedTargetException,
301                 ::com::sun::star::uno::RuntimeException);
302 
303     // XTextContent
304     virtual void SAL_CALL attach(
305             const ::com::sun::star::uno::Reference<
306                 ::com::sun::star::text::XTextRange > & xTextRange)
307         throw (::com::sun::star::lang::IllegalArgumentException,
308                 ::com::sun::star::uno::RuntimeException);
309     virtual ::com::sun::star::uno::Reference<
310                 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
311         throw (::com::sun::star::uno::RuntimeException);
312 
313     // XDocumentIndexMark
314     virtual rtl::OUString SAL_CALL getMarkEntry()
315         throw (::com::sun::star::uno::RuntimeException);
316     virtual void SAL_CALL setMarkEntry(const rtl::OUString& rIndexEntry)
317         throw (::com::sun::star::uno::RuntimeException);
318 
319 };
320 
321 /* -----------------05.05.99 12:27-------------------
322  *
323  * --------------------------------------------------*/
324 class SwXDocumentIndexes
325     : public SwCollectionBaseClass
326     , public SwUnoCollection
327 {
328 
329 private:
330 
331 	virtual ~SwXDocumentIndexes();
332 
333 public:
334 
335     SwXDocumentIndexes(SwDoc *const pDoc);
336 
337     // XServiceInfo
338     virtual ::rtl::OUString SAL_CALL getImplementationName()
339         throw (::com::sun::star::uno::RuntimeException);
340     virtual sal_Bool SAL_CALL supportsService(
341             const ::rtl::OUString& rServiceName)
342         throw (::com::sun::star::uno::RuntimeException);
343     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
344         getSupportedServiceNames()
345         throw (::com::sun::star::uno::RuntimeException);
346 
347     // XElementAccess
348     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
349         throw (::com::sun::star::uno::RuntimeException);
350     virtual sal_Bool SAL_CALL hasElements()
351         throw (::com::sun::star::uno::RuntimeException);
352 
353     // XIndexAccess
354     virtual sal_Int32 SAL_CALL getCount()
355         throw (::com::sun::star::uno::RuntimeException);
356     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
357         throw (::com::sun::star::lang::IndexOutOfBoundsException,
358                 ::com::sun::star::lang::WrappedTargetException,
359                 ::com::sun::star::uno::RuntimeException);
360 
361     // XNameAccess
362     virtual ::com::sun::star::uno::Any SAL_CALL getByName(
363             const ::rtl::OUString& rName)
364         throw (::com::sun::star::container::NoSuchElementException,
365                 ::com::sun::star::lang::WrappedTargetException,
366                 ::com::sun::star::uno::RuntimeException);
367     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
368         getElementNames() throw (::com::sun::star::uno::RuntimeException);
369     virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& rName)
370         throw (::com::sun::star::uno::RuntimeException);
371 
372 };
373 
374 #endif
375 
376