Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef SC_AFMTUNO_HXX
21 : : #define SC_AFMTUNO_HXX
22 : :
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>
41 : :
42 : : class ScAutoFormatFieldObj;
43 : : class ScAutoFormatObj;
44 : :
45 : :
46 : : #define SC_AFMTOBJ_INVALID USHRT_MAX
47 : :
48 : :
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 >& );
53 : :
54 : :
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 >
60 : : {
61 : : private:
62 : : ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
63 : : ScAutoFormatObj* GetObjectByName_Impl(const ::rtl::OUString& aName);
64 : :
65 : : public:
66 : : ScAutoFormatsObj();
67 : : virtual ~ScAutoFormatsObj();
68 : :
69 : : static ::rtl::OUString getImplementationName_Static();
70 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString> getSupportedServiceNames_Static();
71 : :
72 : : // XNameContainer
73 : : virtual void SAL_CALL insertByName( const ::rtl::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 : : virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
80 : : throw(::com::sun::star::container::NoSuchElementException,
81 : : ::com::sun::star::lang::WrappedTargetException,
82 : : ::com::sun::star::uno::RuntimeException);
83 : :
84 : : // XNameReplace
85 : : virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
86 : : const ::com::sun::star::uno::Any& aElement )
87 : : throw(::com::sun::star::lang::IllegalArgumentException,
88 : : ::com::sun::star::container::NoSuchElementException,
89 : : ::com::sun::star::lang::WrappedTargetException,
90 : : ::com::sun::star::uno::RuntimeException);
91 : :
92 : : // XNameAccess
93 : : virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
94 : : throw(::com::sun::star::container::NoSuchElementException,
95 : : ::com::sun::star::lang::WrappedTargetException,
96 : : ::com::sun::star::uno::RuntimeException);
97 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
98 : : throw(::com::sun::star::uno::RuntimeException);
99 : : virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
100 : : throw(::com::sun::star::uno::RuntimeException);
101 : :
102 : : // XElementAccess
103 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
104 : : throw(::com::sun::star::uno::RuntimeException);
105 : : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
106 : :
107 : : // XEnumerationAccess
108 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
109 : : createEnumeration() throw(::com::sun::star::uno::RuntimeException);
110 : :
111 : : // XIndexAccess
112 : : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
113 : : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
114 : : throw(::com::sun::star::lang::IndexOutOfBoundsException,
115 : : ::com::sun::star::lang::WrappedTargetException,
116 : : ::com::sun::star::uno::RuntimeException);
117 : :
118 : : // XServiceInfo
119 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
120 : : throw(::com::sun::star::uno::RuntimeException);
121 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
122 : : throw(::com::sun::star::uno::RuntimeException);
123 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
124 : : throw(::com::sun::star::uno::RuntimeException);
125 : : };
126 : :
127 : :
128 : : class ScAutoFormatObj : public ::cppu::WeakImplHelper6<
129 : : ::com::sun::star::container::XIndexAccess,
130 : : ::com::sun::star::container::XEnumerationAccess,
131 : : ::com::sun::star::container::XNamed,
132 : : ::com::sun::star::beans::XPropertySet,
133 : : ::com::sun::star::lang::XUnoTunnel,
134 : : ::com::sun::star::lang::XServiceInfo >,
135 : : public SfxListener
136 : : {
137 : : private:
138 : : SfxItemPropertySet aPropSet;
139 : : sal_uInt16 nFormatIndex;
140 : :
141 : : ScAutoFormatFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
142 : :
143 : : public:
144 : : ScAutoFormatObj(sal_uInt16 nIndex);
145 : : virtual ~ScAutoFormatObj();
146 : :
147 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
148 : :
149 : : // per getImplementation gerufen:
150 : 111 : sal_Bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
151 : : void InitFormat( sal_uInt16 nNewIndex );
152 : :
153 : : // XIndexAccess
154 : : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
155 : : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
156 : : throw(::com::sun::star::lang::IndexOutOfBoundsException,
157 : : ::com::sun::star::lang::WrappedTargetException,
158 : : ::com::sun::star::uno::RuntimeException);
159 : :
160 : : // XElementAccess
161 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
162 : : throw(::com::sun::star::uno::RuntimeException);
163 : : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
164 : :
165 : : // XEnumerationAccess
166 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
167 : : createEnumeration() throw(::com::sun::star::uno::RuntimeException);
168 : :
169 : : // XNamed
170 : : virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
171 : : virtual void SAL_CALL setName( const ::rtl::OUString& aName )
172 : : throw(::com::sun::star::uno::RuntimeException);
173 : :
174 : : // XPropertySet
175 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
176 : : SAL_CALL getPropertySetInfo()
177 : : throw(::com::sun::star::uno::RuntimeException);
178 : : virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
179 : : const ::com::sun::star::uno::Any& aValue )
180 : : throw(::com::sun::star::beans::UnknownPropertyException,
181 : : ::com::sun::star::beans::PropertyVetoException,
182 : : ::com::sun::star::lang::IllegalArgumentException,
183 : : ::com::sun::star::lang::WrappedTargetException,
184 : : ::com::sun::star::uno::RuntimeException);
185 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
186 : : const ::rtl::OUString& PropertyName )
187 : : throw(::com::sun::star::beans::UnknownPropertyException,
188 : : ::com::sun::star::lang::WrappedTargetException,
189 : : ::com::sun::star::uno::RuntimeException);
190 : : virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
191 : : const ::com::sun::star::uno::Reference<
192 : : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
193 : : throw(::com::sun::star::beans::UnknownPropertyException,
194 : : ::com::sun::star::lang::WrappedTargetException,
195 : : ::com::sun::star::uno::RuntimeException);
196 : : virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
197 : : const ::com::sun::star::uno::Reference<
198 : : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
199 : : throw(::com::sun::star::beans::UnknownPropertyException,
200 : : ::com::sun::star::lang::WrappedTargetException,
201 : : ::com::sun::star::uno::RuntimeException);
202 : : virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
203 : : const ::com::sun::star::uno::Reference<
204 : : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
205 : : throw(::com::sun::star::beans::UnknownPropertyException,
206 : : ::com::sun::star::lang::WrappedTargetException,
207 : : ::com::sun::star::uno::RuntimeException);
208 : : virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
209 : : const ::com::sun::star::uno::Reference<
210 : : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
211 : : throw(::com::sun::star::beans::UnknownPropertyException,
212 : : ::com::sun::star::lang::WrappedTargetException,
213 : : ::com::sun::star::uno::RuntimeException);
214 : :
215 : : // XServiceInfo
216 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
217 : : throw(::com::sun::star::uno::RuntimeException);
218 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
219 : : throw(::com::sun::star::uno::RuntimeException);
220 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
221 : : throw(::com::sun::star::uno::RuntimeException);
222 : :
223 : : // XUnoTunnel
224 : : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
225 : : sal_Int8 >& aIdentifier )
226 : : throw(::com::sun::star::uno::RuntimeException);
227 : :
228 : : static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
229 : : static ScAutoFormatObj* getImplementation( const ::com::sun::star::uno::Reference<
230 : : ::com::sun::star::uno::XInterface> xObj );
231 : : };
232 : :
233 : :
234 : : class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper2<
235 : : ::com::sun::star::beans::XPropertySet,
236 : : ::com::sun::star::lang::XServiceInfo >,
237 : : public SfxListener
238 : : {
239 : : private:
240 : : SfxItemPropertySet aPropSet;
241 : : sal_uInt16 nFormatIndex;
242 : : sal_uInt16 nFieldIndex;
243 : :
244 : : public:
245 : : ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
246 : : virtual ~ScAutoFormatFieldObj();
247 : :
248 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
249 : :
250 : : // XPropertySet
251 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
252 : : SAL_CALL getPropertySetInfo()
253 : : throw(::com::sun::star::uno::RuntimeException);
254 : : virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
255 : : const ::com::sun::star::uno::Any& aValue )
256 : : throw(::com::sun::star::beans::UnknownPropertyException,
257 : : ::com::sun::star::beans::PropertyVetoException,
258 : : ::com::sun::star::lang::IllegalArgumentException,
259 : : ::com::sun::star::lang::WrappedTargetException,
260 : : ::com::sun::star::uno::RuntimeException);
261 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
262 : : const ::rtl::OUString& PropertyName )
263 : : throw(::com::sun::star::beans::UnknownPropertyException,
264 : : ::com::sun::star::lang::WrappedTargetException,
265 : : ::com::sun::star::uno::RuntimeException);
266 : : virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
267 : : const ::com::sun::star::uno::Reference<
268 : : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
269 : : throw(::com::sun::star::beans::UnknownPropertyException,
270 : : ::com::sun::star::lang::WrappedTargetException,
271 : : ::com::sun::star::uno::RuntimeException);
272 : : virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
273 : : const ::com::sun::star::uno::Reference<
274 : : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
275 : : throw(::com::sun::star::beans::UnknownPropertyException,
276 : : ::com::sun::star::lang::WrappedTargetException,
277 : : ::com::sun::star::uno::RuntimeException);
278 : : virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
279 : : const ::com::sun::star::uno::Reference<
280 : : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
281 : : throw(::com::sun::star::beans::UnknownPropertyException,
282 : : ::com::sun::star::lang::WrappedTargetException,
283 : : ::com::sun::star::uno::RuntimeException);
284 : : virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
285 : : const ::com::sun::star::uno::Reference<
286 : : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
287 : : throw(::com::sun::star::beans::UnknownPropertyException,
288 : : ::com::sun::star::lang::WrappedTargetException,
289 : : ::com::sun::star::uno::RuntimeException);
290 : :
291 : : // XServiceInfo
292 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
293 : : throw(::com::sun::star::uno::RuntimeException);
294 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
295 : : throw(::com::sun::star::uno::RuntimeException);
296 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
297 : : throw(::com::sun::star::uno::RuntimeException);
298 : : };
299 : :
300 : :
301 : : #endif
302 : :
303 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|