Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sc / styleuno.hxx
blob616c458ae1134d55ad462ff065d883a3ff8d1675
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: styleuno.hxx,v $
10 * $Revision: 1.8 $
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 #ifndef _SFX_ITEMPROP_HXX //autogen
35 #include <bf_svtools/itemprop.hxx>
36 #endif
38 #ifndef _SFXLSTNER_HXX //autogen
39 #include <bf_svtools/lstner.hxx>
40 #endif
42 #ifndef _RSCSFX_HXX //autogen
43 #include <rsc/rscsfx.hxx>
44 #endif
46 #ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
47 #include <com/sun/star/style/XStyle.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_STYLE_XSTYLELOADER_HPP_
50 #include <com/sun/star/style/XStyleLoader.hpp>
51 #endif
52 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
53 #include <com/sun/star/lang/XServiceInfo.hpp>
54 #endif
55 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
56 #include <com/sun/star/container/XNameContainer.hpp>
57 #endif
58 #ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
59 #include <com/sun/star/container/XIndexReplace.hpp>
60 #endif
61 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
62 #include <com/sun/star/beans/XPropertySet.hpp>
63 #endif
64 #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
65 #include <com/sun/star/beans/XMultiPropertySet.hpp>
66 #endif
67 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
68 #include <com/sun/star/beans/XPropertyState.hpp>
69 #endif
70 #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSTATES_HPP_
71 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
72 #endif
73 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
74 #include <com/sun/star/lang/XUnoTunnel.hpp>
75 #endif
77 #ifndef _CPPUHELPER_IMPLBASE3_HXX_
78 #include <cppuhelper/implbase3.hxx>
79 #endif
80 #ifndef _CPPUHELPER_IMPLBASE4_HXX_
81 #include <cppuhelper/implbase4.hxx>
82 #endif
83 #ifndef _CPPUHELPER_IMPLBASE7_HXX_
84 #include <cppuhelper/implbase7.hxx>
85 #endif
86 namespace binfilter {
88 class ScDocShell;
90 class SfxStyleSheetBase;
91 class ScStyleFamilyObj;
92 class ScStyleObj;
95 class ScStyleNameConversion
97 public:
98 static String DisplayToProgrammaticName( const String& rDispName, UINT16 nType );
99 static String ProgrammaticToDisplayName( const String& rProgName, UINT16 nType );
103 class ScStyleFamiliesObj : public ::cppu::WeakImplHelper4<
104 ::com::sun::star::container::XIndexAccess,
105 ::com::sun::star::container::XNameAccess,
106 ::com::sun::star::style::XStyleLoader,
107 ::com::sun::star::lang::XServiceInfo >,
108 public SfxListener
110 private:
111 ScDocShell* pDocShell;
113 ScStyleFamilyObj* GetObjectByType_Impl(UINT16 Type) const;
114 ScStyleFamilyObj* GetObjectByIndex_Impl(UINT32 nIndex) const;
115 ScStyleFamilyObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const;
117 public:
118 ScStyleFamiliesObj(ScDocShell* pDocSh);
119 virtual ~ScStyleFamiliesObj();
121 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
123 // XIndexAccess
124 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
125 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
126 throw(::com::sun::star::lang::IndexOutOfBoundsException,
127 ::com::sun::star::lang::WrappedTargetException,
128 ::com::sun::star::uno::RuntimeException);
130 // XNameAccess
131 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
132 throw(::com::sun::star::container::NoSuchElementException,
133 ::com::sun::star::lang::WrappedTargetException,
134 ::com::sun::star::uno::RuntimeException);
135 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
136 throw(::com::sun::star::uno::RuntimeException);
137 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
138 throw(::com::sun::star::uno::RuntimeException);
140 // XElementAccess
141 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
142 throw(::com::sun::star::uno::RuntimeException);
143 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
145 // XStyleLoader
146 virtual void SAL_CALL loadStylesFromURL( const ::rtl::OUString& URL,
147 const ::com::sun::star::uno::Sequence<
148 ::com::sun::star::beans::PropertyValue >& aOptions )
149 throw(::com::sun::star::io::IOException,
150 ::com::sun::star::uno::RuntimeException);
151 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
152 getStyleLoaderOptions() throw(::com::sun::star::uno::RuntimeException);
154 // XServiceInfo
155 virtual ::rtl::OUString SAL_CALL getImplementationName()
156 throw(::com::sun::star::uno::RuntimeException);
157 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
158 throw(::com::sun::star::uno::RuntimeException);
159 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
160 throw(::com::sun::star::uno::RuntimeException);
164 class ScStyleFamilyObj : public ::cppu::WeakImplHelper3<
165 ::com::sun::star::container::XNameContainer,
166 ::com::sun::star::container::XIndexAccess,
167 ::com::sun::star::lang::XServiceInfo >,
168 public SfxListener
170 private:
171 ScDocShell* pDocShell;
172 SfxStyleFamily eFamily; // Familie
174 ScStyleObj* GetObjectByIndex_Impl(UINT32 nIndex);
175 ScStyleObj* GetObjectByName_Impl(const ::rtl::OUString& Name);
177 public:
178 ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam);
179 virtual ~ScStyleFamilyObj();
181 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
183 // XNameContainer
184 virtual void SAL_CALL insertByName( const ::rtl::OUString& aName,
185 const ::com::sun::star::uno::Any& aElement )
186 throw(::com::sun::star::lang::IllegalArgumentException,
187 ::com::sun::star::container::ElementExistException,
188 ::com::sun::star::lang::WrappedTargetException,
189 ::com::sun::star::uno::RuntimeException);
190 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
191 throw(::com::sun::star::container::NoSuchElementException,
192 ::com::sun::star::lang::WrappedTargetException,
193 ::com::sun::star::uno::RuntimeException);
195 // XNameReplace
196 virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
197 const ::com::sun::star::uno::Any& aElement )
198 throw(::com::sun::star::lang::IllegalArgumentException,
199 ::com::sun::star::container::NoSuchElementException,
200 ::com::sun::star::lang::WrappedTargetException,
201 ::com::sun::star::uno::RuntimeException);
203 // XNameAccess
204 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
205 throw(::com::sun::star::container::NoSuchElementException,
206 ::com::sun::star::lang::WrappedTargetException,
207 ::com::sun::star::uno::RuntimeException);
208 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
209 throw(::com::sun::star::uno::RuntimeException);
210 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
211 throw(::com::sun::star::uno::RuntimeException);
213 // XIndexAccess
214 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
215 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
216 throw(::com::sun::star::lang::IndexOutOfBoundsException,
217 ::com::sun::star::lang::WrappedTargetException,
218 ::com::sun::star::uno::RuntimeException);
220 // XElementAccess
221 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
222 throw(::com::sun::star::uno::RuntimeException);
223 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
225 // XServiceInfo
226 virtual ::rtl::OUString SAL_CALL getImplementationName()
227 throw(::com::sun::star::uno::RuntimeException);
228 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
229 throw(::com::sun::star::uno::RuntimeException);
230 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
231 throw(::com::sun::star::uno::RuntimeException);
235 class ScStyleObj : public ::cppu::WeakImplHelper7<
236 ::com::sun::star::style::XStyle,
237 ::com::sun::star::beans::XPropertySet,
238 ::com::sun::star::beans::XMultiPropertySet,
239 ::com::sun::star::beans::XPropertyState,
240 ::com::sun::star::beans::XMultiPropertyStates,
241 ::com::sun::star::lang::XUnoTunnel,
242 ::com::sun::star::lang::XServiceInfo >,
243 public SfxListener
245 private:
246 SfxItemPropertySet aPropSet;
247 ScDocShell* pDocShell;
248 SfxStyleFamily eFamily; // Familie
249 String aStyleName;
251 SfxStyleSheetBase* GetStyle_Impl();
252 const SfxItemSet* GetStyleItemSet_Impl( const String& rPropName, const SfxItemPropertyMap*& rpMapEntry );
253 void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
254 const ::com::sun::star::uno::Any* pValue )
255 throw(::com::sun::star::lang::IllegalArgumentException,
256 ::com::sun::star::uno::RuntimeException);
258 public:
259 ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName);
260 virtual ~ScStyleObj();
262 // per getImplementation gerufen:
263 sal_Bool IsInserted() const { return pDocShell != NULL; }
264 SfxStyleFamily GetFamily() const { return eFamily; }
265 void InitDoc( ScDocShell* pNewDocSh, const String& rNewName );
267 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
269 static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
270 CreateEmptyNumberingRules();
272 // XStyle
273 virtual sal_Bool SAL_CALL isUserDefined() throw(::com::sun::star::uno::RuntimeException);
274 virtual sal_Bool SAL_CALL isInUse() throw(::com::sun::star::uno::RuntimeException);
275 virtual ::rtl::OUString SAL_CALL getParentStyle() throw(::com::sun::star::uno::RuntimeException);
276 virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle )
277 throw(::com::sun::star::container::NoSuchElementException,
278 ::com::sun::star::uno::RuntimeException);
280 // XNamed
281 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
282 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
283 throw(::com::sun::star::uno::RuntimeException);
285 // XPropertySet
286 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
287 SAL_CALL getPropertySetInfo()
288 throw(::com::sun::star::uno::RuntimeException);
289 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
290 const ::com::sun::star::uno::Any& aValue )
291 throw(::com::sun::star::beans::UnknownPropertyException,
292 ::com::sun::star::beans::PropertyVetoException,
293 ::com::sun::star::lang::IllegalArgumentException,
294 ::com::sun::star::lang::WrappedTargetException,
295 ::com::sun::star::uno::RuntimeException);
296 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
297 const ::rtl::OUString& PropertyName )
298 throw(::com::sun::star::beans::UnknownPropertyException,
299 ::com::sun::star::lang::WrappedTargetException,
300 ::com::sun::star::uno::RuntimeException);
301 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
302 const ::com::sun::star::uno::Reference<
303 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
304 throw(::com::sun::star::beans::UnknownPropertyException,
305 ::com::sun::star::lang::WrappedTargetException,
306 ::com::sun::star::uno::RuntimeException);
307 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
308 const ::com::sun::star::uno::Reference<
309 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
310 throw(::com::sun::star::beans::UnknownPropertyException,
311 ::com::sun::star::lang::WrappedTargetException,
312 ::com::sun::star::uno::RuntimeException);
313 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
314 const ::com::sun::star::uno::Reference<
315 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
316 throw(::com::sun::star::beans::UnknownPropertyException,
317 ::com::sun::star::lang::WrappedTargetException,
318 ::com::sun::star::uno::RuntimeException);
319 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
320 const ::com::sun::star::uno::Reference<
321 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
322 throw(::com::sun::star::beans::UnknownPropertyException,
323 ::com::sun::star::lang::WrappedTargetException,
324 ::com::sun::star::uno::RuntimeException);
326 // XMultiPropertySet
327 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
328 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
329 throw (::com::sun::star::beans::PropertyVetoException,
330 ::com::sun::star::lang::IllegalArgumentException,
331 ::com::sun::star::lang::WrappedTargetException,
332 ::com::sun::star::uno::RuntimeException);
333 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
334 getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
335 throw (::com::sun::star::uno::RuntimeException);
336 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
337 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
338 throw (::com::sun::star::uno::RuntimeException);
339 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
340 throw (::com::sun::star::uno::RuntimeException);
341 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
342 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
343 throw (::com::sun::star::uno::RuntimeException);
345 // XPropertyState
346 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
347 const ::rtl::OUString& PropertyName )
348 throw(::com::sun::star::beans::UnknownPropertyException,
349 ::com::sun::star::uno::RuntimeException);
350 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
351 getPropertyStates( const ::com::sun::star::uno::Sequence<
352 ::rtl::OUString >& aPropertyName )
353 throw(::com::sun::star::beans::UnknownPropertyException,
354 ::com::sun::star::uno::RuntimeException);
355 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName )
356 throw(::com::sun::star::beans::UnknownPropertyException,
357 ::com::sun::star::uno::RuntimeException);
358 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
359 const ::rtl::OUString& aPropertyName )
360 throw(::com::sun::star::beans::UnknownPropertyException,
361 ::com::sun::star::lang::WrappedTargetException,
362 ::com::sun::star::uno::RuntimeException);
364 // XMultiPropertyStates
365 // getPropertyStates already defined for XPropertyState
366 virtual void SAL_CALL setAllPropertiesToDefault() throw (::com::sun::star::uno::RuntimeException);
367 virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence<
368 ::rtl::OUString >& aPropertyNames )
369 throw (::com::sun::star::beans::UnknownPropertyException,
370 ::com::sun::star::uno::RuntimeException);
371 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
372 getPropertyDefaults( const ::com::sun::star::uno::Sequence<
373 ::rtl::OUString >& aPropertyNames )
374 throw (::com::sun::star::beans::UnknownPropertyException,
375 ::com::sun::star::lang::WrappedTargetException,
376 ::com::sun::star::uno::RuntimeException);
378 // XServiceInfo
379 virtual ::rtl::OUString SAL_CALL getImplementationName()
380 throw(::com::sun::star::uno::RuntimeException);
381 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
382 throw(::com::sun::star::uno::RuntimeException);
383 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
384 throw(::com::sun::star::uno::RuntimeException);
386 // XUnoTunnel
387 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
388 sal_Int8 >& aIdentifier )
389 throw(::com::sun::star::uno::RuntimeException);
391 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
392 static ScStyleObj* getImplementation( const ::com::sun::star::uno::Reference<
393 ::com::sun::star::uno::XInterface> xObj );
397 } //namespace binfilter
398 #endif