1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoidx.hxx,v $
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 ************************************************************************/
33 #include <com/sun/star/text/XDocumentIndexMark.hpp>
34 #include <com/sun/star/text/XDocumentIndex.hpp>
35 #include <com/sun/star/container/XIndexReplace.hpp>
37 #include <unocoll.hxx>
39 class SwTOXBaseSection
;
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
59 friend class SwXIndexStyleAccess_Impl
;
60 friend class SwXIndexTokenAccess_Impl
;
62 SwEventListenerContainer aLstnrCntnr
;
63 const SfxItemPropertySet
* m_pPropSet
;
65 const SwTOXBaseSection
* pBase
;
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
;}
90 virtual ~SwXDocumentIndex();
92 SwXDocumentIndex(const SwTOXBaseSection
* = 0, SwDoc
* = 0);
94 SwXDocumentIndex(TOXTypes eToxType
, SwDoc
& rDoc
);
99 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
102 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
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
);
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
);
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
152 SwEventListenerContainer aLstnrCntnr
;
153 SwDepend aTypeDepend
;
155 const SwTOXMark
* m_pTOXMark
;
156 const SfxItemPropertySet
* m_pPropSet
;
158 sal_Bool bIsDescriptor
;
164 String sSecondaryKey
;
166 String sPrimaryKeyReading
;
167 String sSecondaryKeyReading
;
168 String sUserIndexName
;
170 void InitMap(TOXTypes eToxType
);
172 virtual ~SwXDocumentIndexMark();
174 SwXDocumentIndexMark(TOXTypes eToxType
);
175 SwXDocumentIndexMark(const SwTOXType
* pType
,
176 const SwTOXMark
* pMark
,
182 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
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
);
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
);
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
);
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
);
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
);
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
,
225 /* -----------------05.05.99 12:27-------------------
227 * --------------------------------------------------*/
229 class SwXDocumentIndexes
: public SwCollectionBaseClass
,
230 public SwUnoCollection
233 virtual ~SwXDocumentIndexes();
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 );
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
);
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
);
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
);
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
;
280 virtual ~SwXIndexStyleAccess_Impl();
282 SwXIndexStyleAccess_Impl(SwXDocumentIndex
& rParentIdx
);
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
);
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
);
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
);
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
;
316 virtual ~SwXIndexTokenAccess_Impl();
318 SwXIndexTokenAccess_Impl(SwXDocumentIndex
& rParentIdx
);
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
);
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
);
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
);
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
);