1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_INC_AFMTUNO_HXX
21 #define INCLUDED_SC_INC_AFMTUNO_HXX
23 #include <svl/lstner.hxx>
24 #include <svl/itemprop.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/container/XContainer.hpp>
27 #include <com/sun/star/container/XIndexContainer.hpp>
28 #include <com/sun/star/container/XNameReplace.hpp>
29 #include <com/sun/star/container/XContainerListener.hpp>
30 #include <com/sun/star/container/XSet.hpp>
31 #include <com/sun/star/container/ContainerEvent.hpp>
32 #include <com/sun/star/container/XIndexReplace.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/container/XNamed.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <cppuhelper/implbase2.hxx>
39 #include <cppuhelper/implbase4.hxx>
40 #include <cppuhelper/implbase6.hxx>
42 class ScAutoFormatFieldObj
;
43 class ScAutoFormatObj
;
46 #define SC_AFMTOBJ_INVALID USHRT_MAX
49 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
50 ScAutoFormatsObj_CreateInstance(
51 const ::com::sun::star::uno::Reference
<
52 ::com::sun::star::lang::XMultiServiceFactory
>& );
55 class ScAutoFormatsObj
: public ::cppu::WeakImplHelper4
<
56 ::com::sun::star::container::XNameContainer
,
57 ::com::sun::star::container::XEnumerationAccess
,
58 ::com::sun::star::container::XIndexAccess
,
59 ::com::sun::star::lang::XServiceInfo
>
62 ScAutoFormatObj
* GetObjectByIndex_Impl(sal_uInt16 nIndex
);
63 ScAutoFormatObj
* GetObjectByName_Impl(const OUString
& aName
);
67 virtual ~ScAutoFormatsObj();
69 static OUString
getImplementationName_Static();
70 static ::com::sun::star::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
73 virtual void SAL_CALL
insertByName( const OUString
& aName
,
74 const ::com::sun::star::uno::Any
& aElement
)
75 throw(::com::sun::star::lang::IllegalArgumentException
,
76 ::com::sun::star::container::ElementExistException
,
77 ::com::sun::star::lang::WrappedTargetException
,
78 ::com::sun::star::uno::RuntimeException
,
79 std::exception
) SAL_OVERRIDE
;
80 virtual void SAL_CALL
removeByName( const OUString
& Name
)
81 throw(::com::sun::star::container::NoSuchElementException
,
82 ::com::sun::star::lang::WrappedTargetException
,
83 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
replaceByName( const OUString
& aName
,
87 const ::com::sun::star::uno::Any
& aElement
)
88 throw(::com::sun::star::lang::IllegalArgumentException
,
89 ::com::sun::star::container::NoSuchElementException
,
90 ::com::sun::star::lang::WrappedTargetException
,
91 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
95 throw(::com::sun::star::container::NoSuchElementException
,
96 ::com::sun::star::lang::WrappedTargetException
,
97 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
99 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
101 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
105 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
108 // XEnumerationAccess
109 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
110 createEnumeration() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
113 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
114 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
115 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
116 ::com::sun::star::lang::WrappedTargetException
,
117 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual OUString SAL_CALL
getImplementationName()
121 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
123 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
125 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 class ScAutoFormatObj
: public ::cppu::WeakImplHelper6
<
130 ::com::sun::star::container::XIndexAccess
,
131 ::com::sun::star::container::XEnumerationAccess
,
132 ::com::sun::star::container::XNamed
,
133 ::com::sun::star::beans::XPropertySet
,
134 ::com::sun::star::lang::XUnoTunnel
,
135 ::com::sun::star::lang::XServiceInfo
>,
139 SfxItemPropertySet aPropSet
;
140 sal_uInt16 nFormatIndex
;
142 ScAutoFormatFieldObj
* GetObjectByIndex_Impl(sal_uInt16 nIndex
);
145 ScAutoFormatObj(sal_uInt16 nIndex
);
146 virtual ~ScAutoFormatObj();
148 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
150 // per getImplementation gerufen:
151 bool IsInserted() const { return nFormatIndex
!= SC_AFMTOBJ_INVALID
; }
152 void InitFormat( sal_uInt16 nNewIndex
);
155 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
157 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
158 ::com::sun::star::lang::WrappedTargetException
,
159 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
163 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
164 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
166 // XEnumerationAccess
167 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
168 createEnumeration() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
171 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
172 virtual void SAL_CALL
setName( const OUString
& aName
)
173 throw (::com::sun::star::uno::RuntimeException
,
174 std::exception
) SAL_OVERRIDE
;
177 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
178 SAL_CALL
getPropertySetInfo()
179 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
181 const ::com::sun::star::uno::Any
& aValue
)
182 throw(::com::sun::star::beans::UnknownPropertyException
,
183 ::com::sun::star::beans::PropertyVetoException
,
184 ::com::sun::star::lang::IllegalArgumentException
,
185 ::com::sun::star::lang::WrappedTargetException
,
186 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
188 const OUString
& PropertyName
)
189 throw(::com::sun::star::beans::UnknownPropertyException
,
190 ::com::sun::star::lang::WrappedTargetException
,
191 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
193 const ::com::sun::star::uno::Reference
<
194 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
195 throw(::com::sun::star::beans::UnknownPropertyException
,
196 ::com::sun::star::lang::WrappedTargetException
,
197 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
198 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
199 const ::com::sun::star::uno::Reference
<
200 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
201 throw(::com::sun::star::beans::UnknownPropertyException
,
202 ::com::sun::star::lang::WrappedTargetException
,
203 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
205 const ::com::sun::star::uno::Reference
<
206 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
207 throw(::com::sun::star::beans::UnknownPropertyException
,
208 ::com::sun::star::lang::WrappedTargetException
,
209 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
210 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
211 const ::com::sun::star::uno::Reference
<
212 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
213 throw(::com::sun::star::beans::UnknownPropertyException
,
214 ::com::sun::star::lang::WrappedTargetException
,
215 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
218 virtual OUString SAL_CALL
getImplementationName()
219 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
220 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
221 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
222 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
223 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
227 sal_Int8
>& aIdentifier
)
228 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
230 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
231 static ScAutoFormatObj
* getImplementation( const ::com::sun::star::uno::Reference
<
232 ::com::sun::star::uno::XInterface
> xObj
);
236 class ScAutoFormatFieldObj
: public ::cppu::WeakImplHelper2
<
237 ::com::sun::star::beans::XPropertySet
,
238 ::com::sun::star::lang::XServiceInfo
>,
242 SfxItemPropertySet aPropSet
;
243 sal_uInt16 nFormatIndex
;
244 sal_uInt16 nFieldIndex
;
247 ScAutoFormatFieldObj(sal_uInt16 nFormat
, sal_uInt16 nField
);
248 virtual ~ScAutoFormatFieldObj();
250 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
253 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
254 SAL_CALL
getPropertySetInfo()
255 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
256 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
257 const ::com::sun::star::uno::Any
& aValue
)
258 throw(::com::sun::star::beans::UnknownPropertyException
,
259 ::com::sun::star::beans::PropertyVetoException
,
260 ::com::sun::star::lang::IllegalArgumentException
,
261 ::com::sun::star::lang::WrappedTargetException
,
262 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
263 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
264 const OUString
& PropertyName
)
265 throw(::com::sun::star::beans::UnknownPropertyException
,
266 ::com::sun::star::lang::WrappedTargetException
,
267 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
268 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
269 const ::com::sun::star::uno::Reference
<
270 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
271 throw(::com::sun::star::beans::UnknownPropertyException
,
272 ::com::sun::star::lang::WrappedTargetException
,
273 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
274 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
275 const ::com::sun::star::uno::Reference
<
276 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
277 throw(::com::sun::star::beans::UnknownPropertyException
,
278 ::com::sun::star::lang::WrappedTargetException
,
279 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
280 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
281 const ::com::sun::star::uno::Reference
<
282 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
283 throw(::com::sun::star::beans::UnknownPropertyException
,
284 ::com::sun::star::lang::WrappedTargetException
,
285 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
286 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
287 const ::com::sun::star::uno::Reference
<
288 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
289 throw(::com::sun::star::beans::UnknownPropertyException
,
290 ::com::sun::star::lang::WrappedTargetException
,
291 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
294 virtual OUString SAL_CALL
getImplementationName()
295 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
296 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
297 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
298 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
299 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */