xref: /trunk/main/sw/inc/unoidx.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 #ifndef _UNOIDX_HXX
24 #define _UNOIDX_HXX
25 
26 #include <com/sun/star/lang/XUnoTunnel.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/container/XNamed.hpp>
29 #include <com/sun/star/text/XDocumentIndexMark.hpp>
30 #include <com/sun/star/text/XDocumentIndex.hpp>
31 
32 #include <cppuhelper/implbase4.hxx>
33 #include <cppuhelper/implbase5.hxx>
34 
35 #include <sfx2/Metadatable.hxx>
36 
37 #include <unocoll.hxx>
38 #include <toxe.hxx>
39 
40 
41 class SwTOXBaseSection;
42 class SwTOXMark;
43 class SwTOXType;
44 
45 /* -----------------07.12.98 10:08-------------------
46  *
47  * --------------------------------------------------*/
48 
49 typedef ::cppu::ImplInheritanceHelper5
50 <   ::sfx2::MetadatableMixin
51 ,   ::com::sun::star::lang::XUnoTunnel
52 ,   ::com::sun::star::lang::XServiceInfo
53 ,   ::com::sun::star::beans::XPropertySet
54 ,   ::com::sun::star::container::XNamed
55 ,   ::com::sun::star::text::XDocumentIndex
56 > SwXDocumentIndex_Base;
57 
58 class SwXDocumentIndex
59     : public SwXDocumentIndex_Base
60 {
61 
62 private:
63 
64     class StyleAccess_Impl;
65     class TokenAccess_Impl;
66 
67     class Impl;
68     ::sw::UnoImplPtr<Impl> m_pImpl;
69 
70     virtual ~SwXDocumentIndex();
71 
72     SwXDocumentIndex(SwTOXBaseSection const&, SwDoc &);
73 
74 public:
75 
76     /// descriptor
77     SwXDocumentIndex(const TOXTypes eToxType, SwDoc& rDoc);
78 
79     static ::com::sun::star::uno::Reference<
80             ::com::sun::star::text::XDocumentIndex>
81         CreateXDocumentIndex(SwDoc & rDoc, SwTOXBaseSection const& rSection);
82 
83     // MetadatableMixin
84     virtual ::sfx2::Metadatable* GetCoreObject();
85     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
86         GetModel();
87 
88     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
89 
90     // XUnoTunnel
91     virtual sal_Int64 SAL_CALL getSomething(
92             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier);
93 
94     // XServiceInfo
95     virtual ::rtl::OUString SAL_CALL getImplementationName();
96     virtual sal_Bool SAL_CALL supportsService(
97             const ::rtl::OUString& rServiceName);
98     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
99         getSupportedServiceNames();
100 
101     // XComponent
102     virtual void SAL_CALL dispose();
103     virtual void SAL_CALL addEventListener(
104             const ::com::sun::star::uno::Reference<
105                 ::com::sun::star::lang::XEventListener > & xListener);
106     virtual void SAL_CALL removeEventListener(
107             const ::com::sun::star::uno::Reference<
108                 ::com::sun::star::lang::XEventListener > & xListener);
109 
110     // XPropertySet
111     virtual ::com::sun::star::uno::Reference<
112                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
113         getPropertySetInfo();
114     virtual void SAL_CALL setPropertyValue(
115             const ::rtl::OUString& rPropertyName,
116             const ::com::sun::star::uno::Any& rValue);
117     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
118             const ::rtl::OUString& rPropertyName);
119     virtual void SAL_CALL addPropertyChangeListener(
120             const ::rtl::OUString& rPropertyName,
121             const ::com::sun::star::uno::Reference<
122                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
123     virtual void SAL_CALL removePropertyChangeListener(
124             const ::rtl::OUString& rPropertyName,
125             const ::com::sun::star::uno::Reference<
126                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
127     virtual void SAL_CALL addVetoableChangeListener(
128             const ::rtl::OUString& rPropertyName,
129             const ::com::sun::star::uno::Reference<
130                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
131     virtual void SAL_CALL removeVetoableChangeListener(
132             const ::rtl::OUString& rPropertyName,
133             const ::com::sun::star::uno::Reference<
134                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
135 
136     // XNamed
137     virtual ::rtl::OUString SAL_CALL getName();
138     virtual void SAL_CALL setName(const ::rtl::OUString& rName);
139 
140     // XTextContent
141     virtual void SAL_CALL attach(
142             const ::com::sun::star::uno::Reference<
143                 ::com::sun::star::text::XTextRange > & xTextRange);
144     virtual ::com::sun::star::uno::Reference<
145                 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor();
146 
147 
148     // XDocumentIndex
149     virtual ::rtl::OUString SAL_CALL getServiceName();
150     virtual void SAL_CALL update();
151 
152 };
153 
154 /* -----------------07.12.98 10:08-------------------
155  *
156  * --------------------------------------------------*/
157 typedef ::cppu::WeakImplHelper4
158 <   ::com::sun::star::lang::XUnoTunnel
159 ,   ::com::sun::star::lang::XServiceInfo
160 ,   ::com::sun::star::beans::XPropertySet
161 ,   ::com::sun::star::text::XDocumentIndexMark
162 > SwXDocumentIndexMark_Base;
163 
164 class SwXDocumentIndexMark
165     : public SwXDocumentIndexMark_Base
166 {
167 
168 private:
169 
170     class Impl;
171     ::sw::UnoImplPtr<Impl> m_pImpl;
172 
173     virtual ~SwXDocumentIndexMark();
174 
175     SwXDocumentIndexMark(SwDoc & rDoc,
176                 SwTOXType & rType, SwTOXMark & rMark);
177 
178 public:
179 
180     /// descriptor
181     SwXDocumentIndexMark(const TOXTypes eToxType);
182 
183     static ::com::sun::star::uno::Reference<
184             ::com::sun::star::text::XDocumentIndexMark>
185         CreateXDocumentIndexMark(SwDoc & rDoc,
186                 SwTOXType & rType, SwTOXMark & rMark);
187 
188     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
189 
190     // XUnoTunnel
191     virtual sal_Int64 SAL_CALL getSomething(
192             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier);
193 
194     // XServiceInfo
195     virtual ::rtl::OUString SAL_CALL getImplementationName();
196     virtual sal_Bool SAL_CALL supportsService(
197             const ::rtl::OUString& rServiceName);
198     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
199         getSupportedServiceNames();
200 
201     // XComponent
202     virtual void SAL_CALL dispose();
203     virtual void SAL_CALL addEventListener(
204             const ::com::sun::star::uno::Reference<
205                 ::com::sun::star::lang::XEventListener > & xListener);
206     virtual void SAL_CALL removeEventListener(
207             const ::com::sun::star::uno::Reference<
208                 ::com::sun::star::lang::XEventListener > & xListener);
209 
210     // XPropertySet
211     virtual ::com::sun::star::uno::Reference<
212                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
213         getPropertySetInfo();
214     virtual void SAL_CALL setPropertyValue(
215             const ::rtl::OUString& rPropertyName,
216             const ::com::sun::star::uno::Any& rValue);
217     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
218             const ::rtl::OUString& rPropertyName);
219     virtual void SAL_CALL addPropertyChangeListener(
220             const ::rtl::OUString& rPropertyName,
221             const ::com::sun::star::uno::Reference<
222                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
223     virtual void SAL_CALL removePropertyChangeListener(
224             const ::rtl::OUString& rPropertyName,
225             const ::com::sun::star::uno::Reference<
226                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
227     virtual void SAL_CALL addVetoableChangeListener(
228             const ::rtl::OUString& rPropertyName,
229             const ::com::sun::star::uno::Reference<
230                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
231     virtual void SAL_CALL removeVetoableChangeListener(
232             const ::rtl::OUString& rPropertyName,
233             const ::com::sun::star::uno::Reference<
234                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
235 
236     // XTextContent
237     virtual void SAL_CALL attach(
238             const ::com::sun::star::uno::Reference<
239                 ::com::sun::star::text::XTextRange > & xTextRange);
240     virtual ::com::sun::star::uno::Reference<
241                 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor();
242 
243     // XDocumentIndexMark
244     virtual rtl::OUString SAL_CALL getMarkEntry();
245     virtual void SAL_CALL setMarkEntry(const rtl::OUString& rIndexEntry);
246 
247 };
248 
249 /* -----------------05.05.99 12:27-------------------
250  *
251  * --------------------------------------------------*/
252 class SwXDocumentIndexes
253     : public SwCollectionBaseClass
254     , public SwUnoCollection
255 {
256 
257 private:
258 
259     virtual ~SwXDocumentIndexes();
260 
261 public:
262 
263     SwXDocumentIndexes(SwDoc *const pDoc);
264 
265     // XServiceInfo
266     virtual ::rtl::OUString SAL_CALL getImplementationName();
267     virtual sal_Bool SAL_CALL supportsService(
268             const ::rtl::OUString& rServiceName);
269     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
270         getSupportedServiceNames();
271 
272     // XElementAccess
273     virtual ::com::sun::star::uno::Type SAL_CALL getElementType();
274     virtual sal_Bool SAL_CALL hasElements();
275 
276     // XIndexAccess
277     virtual sal_Int32 SAL_CALL getCount();
278     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex);
279 
280     // XNameAccess
281     virtual ::com::sun::star::uno::Any SAL_CALL getByName(
282             const ::rtl::OUString& rName);
283     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
284         getElementNames();
285     virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& rName);
286 
287 };
288 
289 #endif
290