update dev300-m57
[ooovba.git] / sc / inc / styleuno.hxx
blobc0629e638b80442d24c634a3f6941fb692a09da1
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: styleuno.hxx,v $
10 * $Revision: 1.6.32.1 $
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_STYLEUNO_HXX
32 #define SC_STYLEUNO_HXX
34 #include <svtools/itemprop.hxx>
35 #include <svtools/lstner.hxx>
36 #include <rsc/rscsfx.hxx>
37 #include <com/sun/star/container/XIndexAccess.hpp>
38 #include <com/sun/star/style/XStyle.hpp>
39 #include <com/sun/star/style/XStyleLoader.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/container/XNameContainer.hpp>
42 #include <com/sun/star/container/XIndexReplace.hpp>
43 #include <com/sun/star/beans/XPropertySet.hpp>
44 #include <com/sun/star/beans/XMultiPropertySet.hpp>
45 #include <com/sun/star/beans/XPropertyState.hpp>
46 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
47 #include <com/sun/star/lang/XUnoTunnel.hpp>
48 //#include <cppuhelper/implbase3.hxx>
49 #include <cppuhelper/implbase4.hxx>
50 #include <cppuhelper/implbase7.hxx>
52 class SfxStyleSheetBase;
53 class ScDocShell;
55 class ScStyleFamilyObj;
56 class ScStyleObj;
59 class ScStyleNameConversion
61 public:
62 static String DisplayToProgrammaticName( const String& rDispName, UINT16 nType );
63 static String ProgrammaticToDisplayName( const String& rProgName, UINT16 nType );
67 class ScStyleFamiliesObj : public ::cppu::WeakImplHelper4<
68 ::com::sun::star::container::XIndexAccess,
69 ::com::sun::star::container::XNameAccess,
70 ::com::sun::star::style::XStyleLoader,
71 ::com::sun::star::lang::XServiceInfo >,
72 public SfxListener
74 private:
75 ScDocShell* pDocShell;
77 ScStyleFamilyObj* GetObjectByType_Impl(UINT16 Type) const;
78 ScStyleFamilyObj* GetObjectByIndex_Impl(UINT32 nIndex) const;
79 ScStyleFamilyObj* GetObjectByName_Impl(const rtl::OUString& aName) const;
81 public:
82 ScStyleFamiliesObj(ScDocShell* pDocSh);
83 virtual ~ScStyleFamiliesObj();
85 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
87 // XIndexAccess
88 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
89 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
90 throw(::com::sun::star::lang::IndexOutOfBoundsException,
91 ::com::sun::star::lang::WrappedTargetException,
92 ::com::sun::star::uno::RuntimeException);
94 // XNameAccess
95 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
96 throw(::com::sun::star::container::NoSuchElementException,
97 ::com::sun::star::lang::WrappedTargetException,
98 ::com::sun::star::uno::RuntimeException);
99 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
100 throw(::com::sun::star::uno::RuntimeException);
101 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
102 throw(::com::sun::star::uno::RuntimeException);
104 // XElementAccess
105 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
106 throw(::com::sun::star::uno::RuntimeException);
107 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
109 // XStyleLoader
110 virtual void SAL_CALL loadStylesFromURL( const ::rtl::OUString& URL,
111 const ::com::sun::star::uno::Sequence<
112 ::com::sun::star::beans::PropertyValue >& aOptions )
113 throw(::com::sun::star::io::IOException,
114 ::com::sun::star::uno::RuntimeException);
115 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
116 getStyleLoaderOptions() throw(::com::sun::star::uno::RuntimeException);
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);
128 class ScStyleFamilyObj : public ::cppu::WeakImplHelper4<
129 ::com::sun::star::container::XNameContainer,
130 ::com::sun::star::container::XIndexAccess,
131 ::com::sun::star::beans::XPropertySet,
132 ::com::sun::star::lang::XServiceInfo >,
133 public SfxListener
135 private:
136 ScDocShell* pDocShell;
137 SfxStyleFamily eFamily; // Familie
139 ScStyleObj* GetObjectByIndex_Impl(UINT32 nIndex);
140 ScStyleObj* GetObjectByName_Impl(const rtl::OUString& Name);
142 public:
143 ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam);
144 virtual ~ScStyleFamilyObj();
146 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
148 // XNameContainer
149 virtual void SAL_CALL insertByName( const ::rtl::OUString& aName,
150 const ::com::sun::star::uno::Any& aElement )
151 throw(::com::sun::star::lang::IllegalArgumentException,
152 ::com::sun::star::container::ElementExistException,
153 ::com::sun::star::lang::WrappedTargetException,
154 ::com::sun::star::uno::RuntimeException);
155 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
156 throw(::com::sun::star::container::NoSuchElementException,
157 ::com::sun::star::lang::WrappedTargetException,
158 ::com::sun::star::uno::RuntimeException);
160 // XNameReplace
161 virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
162 const ::com::sun::star::uno::Any& aElement )
163 throw(::com::sun::star::lang::IllegalArgumentException,
164 ::com::sun::star::container::NoSuchElementException,
165 ::com::sun::star::lang::WrappedTargetException,
166 ::com::sun::star::uno::RuntimeException);
168 // XNameAccess
169 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
170 throw(::com::sun::star::container::NoSuchElementException,
171 ::com::sun::star::lang::WrappedTargetException,
172 ::com::sun::star::uno::RuntimeException);
173 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
174 throw(::com::sun::star::uno::RuntimeException);
175 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
176 throw(::com::sun::star::uno::RuntimeException);
178 // XIndexAccess
179 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
180 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
181 throw(::com::sun::star::lang::IndexOutOfBoundsException,
182 ::com::sun::star::lang::WrappedTargetException,
183 ::com::sun::star::uno::RuntimeException);
185 // XElementAccess
186 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
187 throw(::com::sun::star::uno::RuntimeException);
188 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
190 // XPropertySet
191 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
192 throw (::com::sun::star::uno::RuntimeException);
193 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
194 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);
195 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
196 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
197 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
198 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
199 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
200 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
201 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
202 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
203 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
204 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
206 // XServiceInfo
207 virtual ::rtl::OUString SAL_CALL getImplementationName()
208 throw(::com::sun::star::uno::RuntimeException);
209 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
210 throw(::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
212 throw(::com::sun::star::uno::RuntimeException);
216 class ScStyleObj : public ::cppu::WeakImplHelper7<
217 ::com::sun::star::style::XStyle,
218 ::com::sun::star::beans::XPropertySet,
219 ::com::sun::star::beans::XMultiPropertySet,
220 ::com::sun::star::beans::XPropertyState,
221 ::com::sun::star::beans::XMultiPropertyStates,
222 ::com::sun::star::lang::XUnoTunnel,
223 ::com::sun::star::lang::XServiceInfo >,
224 public SfxListener
226 private:
227 const SfxItemPropertySet* pPropSet;
228 ScDocShell* pDocShell;
229 SfxStyleFamily eFamily; // Familie
230 String aStyleName;
232 SfxStyleSheetBase* GetStyle_Impl();
233 const SfxItemSet* GetStyleItemSet_Impl( const ::rtl::OUString& rPropName, const SfxItemPropertySimpleEntry*& rpEntry );
234 void SetOnePropertyValue( const ::rtl::OUString& rPropertyName,
235 const SfxItemPropertySimpleEntry* pEntry,
236 const ::com::sun::star::uno::Any* pValue )
237 throw(::com::sun::star::lang::IllegalArgumentException,
238 ::com::sun::star::uno::RuntimeException);
240 ScStyleObj(); // disabled
241 public:
242 ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName);
243 virtual ~ScStyleObj();
245 // per getImplementation gerufen:
246 sal_Bool IsInserted() const { return pDocShell != NULL; }
247 SfxStyleFamily GetFamily() const { return eFamily; }
248 void InitDoc( ScDocShell* pNewDocSh, const String& rNewName );
250 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
252 static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
253 CreateEmptyNumberingRules();
255 // XStyle
256 virtual sal_Bool SAL_CALL isUserDefined() throw(::com::sun::star::uno::RuntimeException);
257 virtual sal_Bool SAL_CALL isInUse() throw(::com::sun::star::uno::RuntimeException);
258 virtual ::rtl::OUString SAL_CALL getParentStyle() throw(::com::sun::star::uno::RuntimeException);
259 virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle )
260 throw(::com::sun::star::container::NoSuchElementException,
261 ::com::sun::star::uno::RuntimeException);
263 // XNamed
264 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
265 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
266 throw(::com::sun::star::uno::RuntimeException);
268 // XPropertySet
269 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
270 SAL_CALL getPropertySetInfo()
271 throw(::com::sun::star::uno::RuntimeException);
272 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
273 const ::com::sun::star::uno::Any& aValue )
274 throw(::com::sun::star::beans::UnknownPropertyException,
275 ::com::sun::star::beans::PropertyVetoException,
276 ::com::sun::star::lang::IllegalArgumentException,
277 ::com::sun::star::lang::WrappedTargetException,
278 ::com::sun::star::uno::RuntimeException);
279 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
280 const ::rtl::OUString& PropertyName )
281 throw(::com::sun::star::beans::UnknownPropertyException,
282 ::com::sun::star::lang::WrappedTargetException,
283 ::com::sun::star::uno::RuntimeException);
284 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
285 const ::com::sun::star::uno::Reference<
286 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
287 throw(::com::sun::star::beans::UnknownPropertyException,
288 ::com::sun::star::lang::WrappedTargetException,
289 ::com::sun::star::uno::RuntimeException);
290 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
291 const ::com::sun::star::uno::Reference<
292 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
293 throw(::com::sun::star::beans::UnknownPropertyException,
294 ::com::sun::star::lang::WrappedTargetException,
295 ::com::sun::star::uno::RuntimeException);
296 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
297 const ::com::sun::star::uno::Reference<
298 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
299 throw(::com::sun::star::beans::UnknownPropertyException,
300 ::com::sun::star::lang::WrappedTargetException,
301 ::com::sun::star::uno::RuntimeException);
302 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
303 const ::com::sun::star::uno::Reference<
304 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
305 throw(::com::sun::star::beans::UnknownPropertyException,
306 ::com::sun::star::lang::WrappedTargetException,
307 ::com::sun::star::uno::RuntimeException);
309 // XMultiPropertySet
310 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
311 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
312 throw (::com::sun::star::beans::PropertyVetoException,
313 ::com::sun::star::lang::IllegalArgumentException,
314 ::com::sun::star::lang::WrappedTargetException,
315 ::com::sun::star::uno::RuntimeException);
316 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
317 getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
318 throw (::com::sun::star::uno::RuntimeException);
319 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
320 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
321 throw (::com::sun::star::uno::RuntimeException);
322 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
323 throw (::com::sun::star::uno::RuntimeException);
324 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
325 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
326 throw (::com::sun::star::uno::RuntimeException);
328 // XPropertyState
329 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
330 const ::rtl::OUString& PropertyName )
331 throw(::com::sun::star::beans::UnknownPropertyException,
332 ::com::sun::star::uno::RuntimeException);
333 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
334 getPropertyStates( const ::com::sun::star::uno::Sequence<
335 ::rtl::OUString >& aPropertyName )
336 throw(::com::sun::star::beans::UnknownPropertyException,
337 ::com::sun::star::uno::RuntimeException);
338 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName )
339 throw(::com::sun::star::beans::UnknownPropertyException,
340 ::com::sun::star::uno::RuntimeException);
341 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
342 const ::rtl::OUString& aPropertyName )
343 throw(::com::sun::star::beans::UnknownPropertyException,
344 ::com::sun::star::lang::WrappedTargetException,
345 ::com::sun::star::uno::RuntimeException);
347 // XMultiPropertyStates
348 // getPropertyStates already defined for XPropertyState
349 virtual void SAL_CALL setAllPropertiesToDefault() throw (::com::sun::star::uno::RuntimeException);
350 virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence<
351 ::rtl::OUString >& aPropertyNames )
352 throw (::com::sun::star::beans::UnknownPropertyException,
353 ::com::sun::star::uno::RuntimeException);
354 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
355 getPropertyDefaults( const ::com::sun::star::uno::Sequence<
356 ::rtl::OUString >& aPropertyNames )
357 throw (::com::sun::star::beans::UnknownPropertyException,
358 ::com::sun::star::lang::WrappedTargetException,
359 ::com::sun::star::uno::RuntimeException);
361 // XServiceInfo
362 virtual ::rtl::OUString SAL_CALL getImplementationName()
363 throw(::com::sun::star::uno::RuntimeException);
364 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
365 throw(::com::sun::star::uno::RuntimeException);
366 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
367 throw(::com::sun::star::uno::RuntimeException);
369 // XUnoTunnel
370 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
371 sal_Int8 >& aIdentifier )
372 throw(::com::sun::star::uno::RuntimeException);
374 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
375 static ScStyleObj* getImplementation( const ::com::sun::star::uno::Reference<
376 ::com::sun::star::uno::XInterface> xObj );
380 #endif