merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / unoidx.hxx
blob544399d544f712338eea2736723bf8318469676d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoidx.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _UNOIDX_HXX
31 #define _UNOIDX_HXX
33 #include <com/sun/star/text/XDocumentIndexMark.hpp>
34 #include <com/sun/star/text/XDocumentIndex.hpp>
35 #include <com/sun/star/container/XIndexReplace.hpp>
36 #include <unoobj.hxx>
37 #include <unocoll.hxx>
38 #include <toxe.hxx>
39 class SwTOXBaseSection;
40 class SwTOXMark;
41 class SwTOXType;
42 /* -----------------07.12.98 10:08-------------------
44 * --------------------------------------------------*/
45 class SwDocIdxProperties_Impl;
46 class SwXIndexStyleAccess_Impl;
47 class SwXIndexTokenAccess_Impl;
49 class SwXDocumentIndex : public cppu::WeakImplHelper5
51 ::com::sun::star::text::XDocumentIndex,
52 ::com::sun::star::lang::XServiceInfo,
53 ::com::sun::star::beans::XPropertySet,
54 ::com::sun::star::container::XNamed,
55 ::com::sun::star::lang::XUnoTunnel
57 public SwClient
59 friend class SwXIndexStyleAccess_Impl;
60 friend class SwXIndexTokenAccess_Impl;
62 SwEventListenerContainer aLstnrCntnr;
63 const SfxItemPropertySet* m_pPropSet;
64 SwDoc* m_pDoc;
65 const SwTOXBaseSection* pBase;
66 TOXTypes eTOXType;
68 //Descriptor-Interface
69 sal_Bool bIsDescriptor;
70 SwDocIdxProperties_Impl* pProps;
72 SwXIndexStyleAccess_Impl* pStyleAccess;
73 SwXIndexTokenAccess_Impl* pTokenAccess;
75 SwSectionFmt* GetFmt()const {return (SwSectionFmt*)GetRegisteredIn();}
77 sal_Bool IsDescriptor() const {return bIsDescriptor;}
78 const SwDocIdxProperties_Impl* GetProperties_Impl() const { return pProps;}
79 SwDocIdxProperties_Impl* GetProperties_Impl() { return pProps;}
80 TOXTypes GetTOXType() const {return eTOXType;}
82 SwXIndexStyleAccess_Impl* GetStyleAccess() const {return pStyleAccess;}
83 void SetStyleAccess(SwXIndexStyleAccess_Impl* pSet)
84 {pStyleAccess = pSet;}
86 SwXIndexTokenAccess_Impl* GetTokenAccess() const {return pTokenAccess;}
87 void SetTokenAccess(SwXIndexTokenAccess_Impl* pSet)
88 {pTokenAccess = pSet;}
89 protected:
90 virtual ~SwXDocumentIndex();
91 public:
92 SwXDocumentIndex(const SwTOXBaseSection* = 0, SwDoc* = 0);
93 //Descriptor-Ctor
94 SwXDocumentIndex(TOXTypes eToxType, SwDoc& rDoc);
97 TYPEINFO();
99 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
101 //XUnoTunnel
102 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
104 //XDocumentIndex
105 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL update( ) throw(::com::sun::star::uno::RuntimeException);
108 //XPropertySet
109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
110 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
111 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
113 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
117 //XTextContent
118 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
119 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
121 //XComponent
122 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
123 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
124 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
126 //XNamed
127 virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
128 virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
130 //XServiceInfo
131 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
132 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
133 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
135 //SwClient
136 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
138 void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
140 /* -----------------07.12.98 10:08-------------------
142 * --------------------------------------------------*/
143 class SwXDocumentIndexMark : public cppu::WeakImplHelper4
145 ::com::sun::star::text::XDocumentIndexMark,
146 ::com::sun::star::lang::XServiceInfo,
147 ::com::sun::star::beans::XPropertySet,
148 ::com::sun::star::lang::XUnoTunnel
150 public SwClient
152 SwEventListenerContainer aLstnrCntnr;
153 SwDepend aTypeDepend;
154 SwDoc* m_pDoc;
155 const SwTOXMark* m_pTOXMark;
156 const SfxItemPropertySet* m_pPropSet;
158 sal_Bool bIsDescriptor;
159 sal_Bool bMainEntry;
160 TOXTypes eType;
161 sal_uInt16 nLevel;
162 String sAltText;
163 String sPrimaryKey;
164 String sSecondaryKey;
165 String sTextReading;
166 String sPrimaryKeyReading;
167 String sSecondaryKeyReading;
168 String sUserIndexName;
170 void InitMap(TOXTypes eToxType);
171 protected:
172 virtual ~SwXDocumentIndexMark();
173 public:
174 SwXDocumentIndexMark(TOXTypes eToxType);
175 SwXDocumentIndexMark(const SwTOXType* pType,
176 const SwTOXMark* pMark,
177 SwDoc* pDc);
180 TYPEINFO();
182 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
184 //XUnoTunnel
185 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
187 virtual rtl::OUString SAL_CALL getMarkEntry(void) throw( ::com::sun::star::uno::RuntimeException );
188 virtual void SAL_CALL setMarkEntry(const rtl::OUString& aIndexEntry) throw( ::com::sun::star::uno::RuntimeException );
190 //XTextContent
191 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
192 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
194 //XComponent
195 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
196 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
197 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
199 //XPropertySet
200 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
201 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
202 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
203 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
204 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
205 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
206 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
208 //XServiceInfo
209 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
210 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
211 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
213 //SwClient
214 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
216 void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
218 SwTOXType* GetTOXType() const {return (SwTOXType*)aTypeDepend.GetRegisteredIn();}
219 const SwTOXMark* GetTOXMark() const {return m_pTOXMark;}
221 static SwXDocumentIndexMark* GetObject(SwTOXType* pType, const SwTOXMark* pMark,
222 SwDoc* pDoc);
223 void Invalidate();
225 /* -----------------05.05.99 12:27-------------------
227 * --------------------------------------------------*/
229 class SwXDocumentIndexes : public SwCollectionBaseClass,
230 public SwUnoCollection
232 protected:
233 virtual ~SwXDocumentIndexes();
234 public:
235 SwXDocumentIndexes(SwDoc* pDoc);
238 // SMART_UNO_DECLARATION( SwXDocumentIndexes, UsrObject );
240 // automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
241 // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void)
243 // throw( ::com::sun::star::uno::RuntimeException );
244 // automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
245 // virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut );
248 //XNameAccess
249 virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
250 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
251 virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
253 //XIndexAccess
254 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
255 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
257 //XElementAccess
258 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
259 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
261 //XServiceInfo
262 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
263 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
264 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
266 static SwXDocumentIndex* GetObject(const SwTOXBaseSection* pTOX);
268 /* -----------------13.09.99 16:39-------------------
270 --------------------------------------------------*/
271 class SwXIndexStyleAccess_Impl : public cppu::WeakImplHelper2
273 ::com::sun::star::container::XIndexReplace,
274 ::com::sun::star::lang::XServiceInfo
277 SwXDocumentIndex& rParent;
278 ::com::sun::star::uno::Reference< ::com::sun::star::text::XDocumentIndex > xParent;
279 protected:
280 virtual ~SwXIndexStyleAccess_Impl();
281 public:
282 SwXIndexStyleAccess_Impl(SwXDocumentIndex& rParentIdx);
285 //XIndexReplace
286 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
288 //XIndexAccess
289 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
290 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
292 //XElementAccess
293 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
294 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
296 //XServiceInfo
297 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
298 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
299 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
303 /* -----------------13.09.99 16:39-------------------
305 --------------------------------------------------*/
306 class SwXIndexTokenAccess_Impl : public cppu::WeakImplHelper2
308 ::com::sun::star::container::XIndexReplace,
309 ::com::sun::star::lang::XServiceInfo
312 SwXDocumentIndex& rParent;
313 ::com::sun::star::uno::Reference< ::com::sun::star::text::XDocumentIndex > xParent;
314 sal_Int32 nCount;
315 protected:
316 virtual ~SwXIndexTokenAccess_Impl();
317 public:
318 SwXIndexTokenAccess_Impl(SwXDocumentIndex& rParentIdx);
322 //XIndexReplace
323 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
325 //XIndexAccess
326 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
327 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
329 //XElementAccess
330 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
331 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
333 //XServiceInfo
334 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
335 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
336 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
340 #endif