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: afmtuno.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 ************************************************************************/
31 #ifndef SC_AFMTUNO_HXX
32 #define SC_AFMTUNO_HXX
34 #include <svtools/lstner.hxx>
35 #include <svtools/itemprop.hxx>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/container/XContainer.hpp>
38 #include <com/sun/star/container/XIndexContainer.hpp>
39 #include <com/sun/star/container/XNameReplace.hpp>
40 #include <com/sun/star/container/XContainerListener.hpp>
41 #include <com/sun/star/container/XSet.hpp>
42 #include <com/sun/star/container/ContainerEvent.hpp>
43 #include <com/sun/star/container/XIndexReplace.hpp>
44 #include <com/sun/star/container/XNameContainer.hpp>
45 #include <com/sun/star/container/XNamed.hpp>
46 #include <com/sun/star/beans/XPropertySet.hpp>
47 #include <com/sun/star/lang/XUnoTunnel.hpp>
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #include <cppuhelper/implbase2.hxx>
50 #include <cppuhelper/implbase4.hxx>
51 #include <cppuhelper/implbase6.hxx>
53 class ScAutoFormatFieldObj
;
54 class ScAutoFormatObj
;
57 #define SC_AFMTOBJ_INVALID USHRT_MAX
60 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
61 ScAutoFormatsObj_CreateInstance(
62 const ::com::sun::star::uno::Reference
<
63 ::com::sun::star::lang::XMultiServiceFactory
>& );
66 class ScAutoFormatsObj
: public ::cppu::WeakImplHelper4
<
67 ::com::sun::star::container::XNameContainer
,
68 ::com::sun::star::container::XEnumerationAccess
,
69 ::com::sun::star::container::XIndexAccess
,
70 ::com::sun::star::lang::XServiceInfo
>
73 ScAutoFormatObj
* GetObjectByIndex_Impl(USHORT nIndex
);
74 ScAutoFormatObj
* GetObjectByName_Impl(const ::rtl::OUString
& aName
);
78 virtual ~ScAutoFormatsObj();
80 static ::rtl::OUString
getImplementationName_Static();
81 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static();
84 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
,
85 const ::com::sun::star::uno::Any
& aElement
)
86 throw(::com::sun::star::lang::IllegalArgumentException
,
87 ::com::sun::star::container::ElementExistException
,
88 ::com::sun::star::lang::WrappedTargetException
,
89 ::com::sun::star::uno::RuntimeException
);
90 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
)
91 throw(::com::sun::star::container::NoSuchElementException
,
92 ::com::sun::star::lang::WrappedTargetException
,
93 ::com::sun::star::uno::RuntimeException
);
96 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
,
97 const ::com::sun::star::uno::Any
& aElement
)
98 throw(::com::sun::star::lang::IllegalArgumentException
,
99 ::com::sun::star::container::NoSuchElementException
,
100 ::com::sun::star::lang::WrappedTargetException
,
101 ::com::sun::star::uno::RuntimeException
);
104 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
105 throw(::com::sun::star::container::NoSuchElementException
,
106 ::com::sun::star::lang::WrappedTargetException
,
107 ::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
109 throw(::com::sun::star::uno::RuntimeException
);
110 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
111 throw(::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
115 throw(::com::sun::star::uno::RuntimeException
);
116 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
118 // XEnumerationAccess
119 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
120 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
123 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
124 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
125 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
126 ::com::sun::star::lang::WrappedTargetException
,
127 ::com::sun::star::uno::RuntimeException
);
130 virtual ::rtl::OUString SAL_CALL
getImplementationName()
131 throw(::com::sun::star::uno::RuntimeException
);
132 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
133 throw(::com::sun::star::uno::RuntimeException
);
134 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
135 throw(::com::sun::star::uno::RuntimeException
);
139 class ScAutoFormatObj
: public ::cppu::WeakImplHelper6
<
140 ::com::sun::star::container::XIndexAccess
,
141 ::com::sun::star::container::XEnumerationAccess
,
142 ::com::sun::star::container::XNamed
,
143 ::com::sun::star::beans::XPropertySet
,
144 ::com::sun::star::lang::XUnoTunnel
,
145 ::com::sun::star::lang::XServiceInfo
>,
149 SfxItemPropertySet aPropSet
;
152 ScAutoFormatFieldObj
* GetObjectByIndex_Impl(USHORT nIndex
);
155 ScAutoFormatObj(USHORT nIndex
);
156 virtual ~ScAutoFormatObj();
158 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
160 // per getImplementation gerufen:
161 sal_Bool
IsInserted() const { return nFormatIndex
!= SC_AFMTOBJ_INVALID
; }
162 void InitFormat( USHORT nNewIndex
);
165 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
166 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
167 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
168 ::com::sun::star::lang::WrappedTargetException
,
169 ::com::sun::star::uno::RuntimeException
);
172 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
173 throw(::com::sun::star::uno::RuntimeException
);
174 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
176 // XEnumerationAccess
177 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
178 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
181 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
182 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
183 throw(::com::sun::star::uno::RuntimeException
);
186 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
187 SAL_CALL
getPropertySetInfo()
188 throw(::com::sun::star::uno::RuntimeException
);
189 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
190 const ::com::sun::star::uno::Any
& aValue
)
191 throw(::com::sun::star::beans::UnknownPropertyException
,
192 ::com::sun::star::beans::PropertyVetoException
,
193 ::com::sun::star::lang::IllegalArgumentException
,
194 ::com::sun::star::lang::WrappedTargetException
,
195 ::com::sun::star::uno::RuntimeException
);
196 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
197 const ::rtl::OUString
& PropertyName
)
198 throw(::com::sun::star::beans::UnknownPropertyException
,
199 ::com::sun::star::lang::WrappedTargetException
,
200 ::com::sun::star::uno::RuntimeException
);
201 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
202 const ::com::sun::star::uno::Reference
<
203 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
204 throw(::com::sun::star::beans::UnknownPropertyException
,
205 ::com::sun::star::lang::WrappedTargetException
,
206 ::com::sun::star::uno::RuntimeException
);
207 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
208 const ::com::sun::star::uno::Reference
<
209 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
210 throw(::com::sun::star::beans::UnknownPropertyException
,
211 ::com::sun::star::lang::WrappedTargetException
,
212 ::com::sun::star::uno::RuntimeException
);
213 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
214 const ::com::sun::star::uno::Reference
<
215 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
216 throw(::com::sun::star::beans::UnknownPropertyException
,
217 ::com::sun::star::lang::WrappedTargetException
,
218 ::com::sun::star::uno::RuntimeException
);
219 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
220 const ::com::sun::star::uno::Reference
<
221 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
222 throw(::com::sun::star::beans::UnknownPropertyException
,
223 ::com::sun::star::lang::WrappedTargetException
,
224 ::com::sun::star::uno::RuntimeException
);
227 virtual ::rtl::OUString SAL_CALL
getImplementationName()
228 throw(::com::sun::star::uno::RuntimeException
);
229 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
230 throw(::com::sun::star::uno::RuntimeException
);
231 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
232 throw(::com::sun::star::uno::RuntimeException
);
235 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
236 sal_Int8
>& aIdentifier
)
237 throw(::com::sun::star::uno::RuntimeException
);
239 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
240 static ScAutoFormatObj
* getImplementation( const ::com::sun::star::uno::Reference
<
241 ::com::sun::star::uno::XInterface
> xObj
);
245 class ScAutoFormatFieldObj
: public ::cppu::WeakImplHelper2
<
246 ::com::sun::star::beans::XPropertySet
,
247 ::com::sun::star::lang::XServiceInfo
>,
251 SfxItemPropertySet aPropSet
;
256 ScAutoFormatFieldObj(USHORT nFormat
, USHORT nField
);
257 virtual ~ScAutoFormatFieldObj();
259 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
262 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
263 SAL_CALL
getPropertySetInfo()
264 throw(::com::sun::star::uno::RuntimeException
);
265 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
266 const ::com::sun::star::uno::Any
& aValue
)
267 throw(::com::sun::star::beans::UnknownPropertyException
,
268 ::com::sun::star::beans::PropertyVetoException
,
269 ::com::sun::star::lang::IllegalArgumentException
,
270 ::com::sun::star::lang::WrappedTargetException
,
271 ::com::sun::star::uno::RuntimeException
);
272 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
273 const ::rtl::OUString
& PropertyName
)
274 throw(::com::sun::star::beans::UnknownPropertyException
,
275 ::com::sun::star::lang::WrappedTargetException
,
276 ::com::sun::star::uno::RuntimeException
);
277 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
278 const ::com::sun::star::uno::Reference
<
279 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
280 throw(::com::sun::star::beans::UnknownPropertyException
,
281 ::com::sun::star::lang::WrappedTargetException
,
282 ::com::sun::star::uno::RuntimeException
);
283 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
284 const ::com::sun::star::uno::Reference
<
285 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
286 throw(::com::sun::star::beans::UnknownPropertyException
,
287 ::com::sun::star::lang::WrappedTargetException
,
288 ::com::sun::star::uno::RuntimeException
);
289 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
290 const ::com::sun::star::uno::Reference
<
291 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
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( const ::rtl::OUString
& PropertyName
,
296 const ::com::sun::star::uno::Reference
<
297 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
298 throw(::com::sun::star::beans::UnknownPropertyException
,
299 ::com::sun::star::lang::WrappedTargetException
,
300 ::com::sun::star::uno::RuntimeException
);
303 virtual ::rtl::OUString SAL_CALL
getImplementationName()
304 throw(::com::sun::star::uno::RuntimeException
);
305 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
306 throw(::com::sun::star::uno::RuntimeException
);
307 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
308 throw(::com::sun::star::uno::RuntimeException
);