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 SC_STYLEUNO_HXX
21 #define SC_STYLEUNO_HXX
23 #include <svl/itemprop.hxx>
24 #include <svl/lstner.hxx>
25 #include <rsc/rscsfx.hxx>
26 #include <com/sun/star/container/XIndexAccess.hpp>
27 #include <com/sun/star/style/XStyle.hpp>
28 #include <com/sun/star/style/XStyleLoader.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/container/XNameContainer.hpp>
31 #include <com/sun/star/container/XIndexReplace.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/beans/XMultiPropertySet.hpp>
34 #include <com/sun/star/beans/XPropertyState.hpp>
35 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <cppuhelper/implbase4.hxx>
38 #include <cppuhelper/implbase7.hxx>
40 class SfxStyleSheetBase
;
43 class ScStyleFamilyObj
;
46 class ScStyleFamiliesObj
: public ::cppu::WeakImplHelper4
<
47 ::com::sun::star::container::XIndexAccess
,
48 ::com::sun::star::container::XNameAccess
,
49 ::com::sun::star::style::XStyleLoader
,
50 ::com::sun::star::lang::XServiceInfo
>,
54 ScDocShell
* pDocShell
;
56 ScStyleFamilyObj
* GetObjectByType_Impl(sal_uInt16 Type
) const;
57 ScStyleFamilyObj
* GetObjectByIndex_Impl(sal_uInt32 nIndex
) const;
58 ScStyleFamilyObj
* GetObjectByName_Impl(const OUString
& aName
) const;
61 ScStyleFamiliesObj(ScDocShell
* pDocSh
);
62 virtual ~ScStyleFamiliesObj();
64 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
67 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
68 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
69 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
70 ::com::sun::star::lang::WrappedTargetException
,
71 ::com::sun::star::uno::RuntimeException
);
74 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
75 throw(::com::sun::star::container::NoSuchElementException
,
76 ::com::sun::star::lang::WrappedTargetException
,
77 ::com::sun::star::uno::RuntimeException
);
78 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
79 throw(::com::sun::star::uno::RuntimeException
);
80 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
81 throw(::com::sun::star::uno::RuntimeException
);
84 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
85 throw(::com::sun::star::uno::RuntimeException
);
86 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
89 virtual void SAL_CALL
loadStylesFromURL( const OUString
& URL
,
90 const ::com::sun::star::uno::Sequence
<
91 ::com::sun::star::beans::PropertyValue
>& aOptions
)
92 throw(::com::sun::star::io::IOException
,
93 ::com::sun::star::uno::RuntimeException
);
94 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
95 getStyleLoaderOptions() throw(::com::sun::star::uno::RuntimeException
);
98 virtual OUString SAL_CALL
getImplementationName()
99 throw(::com::sun::star::uno::RuntimeException
);
100 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
101 throw(::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
103 throw(::com::sun::star::uno::RuntimeException
);
107 class ScStyleFamilyObj
: public ::cppu::WeakImplHelper4
<
108 ::com::sun::star::container::XNameContainer
,
109 ::com::sun::star::container::XIndexAccess
,
110 ::com::sun::star::beans::XPropertySet
,
111 ::com::sun::star::lang::XServiceInfo
>,
115 ScDocShell
* pDocShell
;
116 SfxStyleFamily eFamily
; // Family
118 ScStyleObj
* GetObjectByIndex_Impl(sal_uInt32 nIndex
);
119 ScStyleObj
* GetObjectByName_Impl(const OUString
& Name
);
122 ScStyleFamilyObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
);
123 virtual ~ScStyleFamilyObj();
125 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
128 virtual void SAL_CALL
insertByName( const OUString
& aName
,
129 const ::com::sun::star::uno::Any
& aElement
)
130 throw(::com::sun::star::lang::IllegalArgumentException
,
131 ::com::sun::star::container::ElementExistException
,
132 ::com::sun::star::lang::WrappedTargetException
,
133 ::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
removeByName( const OUString
& Name
)
135 throw(::com::sun::star::container::NoSuchElementException
,
136 ::com::sun::star::lang::WrappedTargetException
,
137 ::com::sun::star::uno::RuntimeException
);
140 virtual void SAL_CALL
replaceByName( const OUString
& aName
,
141 const ::com::sun::star::uno::Any
& aElement
)
142 throw(::com::sun::star::lang::IllegalArgumentException
,
143 ::com::sun::star::container::NoSuchElementException
,
144 ::com::sun::star::lang::WrappedTargetException
,
145 ::com::sun::star::uno::RuntimeException
);
148 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
149 throw(::com::sun::star::container::NoSuchElementException
,
150 ::com::sun::star::lang::WrappedTargetException
,
151 ::com::sun::star::uno::RuntimeException
);
152 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
153 throw(::com::sun::star::uno::RuntimeException
);
154 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
155 throw(::com::sun::star::uno::RuntimeException
);
158 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
159 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
160 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
161 ::com::sun::star::lang::WrappedTargetException
,
162 ::com::sun::star::uno::RuntimeException
);
165 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
166 throw(::com::sun::star::uno::RuntimeException
);
167 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
170 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
171 throw (::com::sun::star::uno::RuntimeException
);
172 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
173 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
);
174 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
175 throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
176 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
177 throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
178 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
179 throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
180 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
181 throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
182 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
183 throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
186 virtual OUString SAL_CALL
getImplementationName()
187 throw(::com::sun::star::uno::RuntimeException
);
188 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
189 throw(::com::sun::star::uno::RuntimeException
);
190 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
191 throw(::com::sun::star::uno::RuntimeException
);
195 class ScStyleObj
: public ::cppu::WeakImplHelper7
<
196 ::com::sun::star::style::XStyle
,
197 ::com::sun::star::beans::XPropertySet
,
198 ::com::sun::star::beans::XMultiPropertySet
,
199 ::com::sun::star::beans::XPropertyState
,
200 ::com::sun::star::beans::XMultiPropertyStates
,
201 ::com::sun::star::lang::XUnoTunnel
,
202 ::com::sun::star::lang::XServiceInfo
>,
206 const SfxItemPropertySet
* pPropSet
;
207 ScDocShell
* pDocShell
;
208 SfxStyleFamily eFamily
; // Family
211 SfxStyleSheetBase
* GetStyle_Impl();
212 const SfxItemSet
* GetStyleItemSet_Impl( const OUString
& rPropName
, const SfxItemPropertySimpleEntry
*& rpEntry
);
213 void SetOnePropertyValue( const OUString
& rPropertyName
,
214 const SfxItemPropertySimpleEntry
* pEntry
,
215 const ::com::sun::star::uno::Any
* pValue
)
216 throw(::com::sun::star::lang::IllegalArgumentException
,
217 ::com::sun::star::uno::RuntimeException
);
219 ScStyleObj(); // disabled
221 ScStyleObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
, const OUString
& rName
);
222 virtual ~ScStyleObj();
224 // created by getImplementation:
225 sal_Bool
IsInserted() const { return pDocShell
!= NULL
; }
226 SfxStyleFamily
GetFamily() const { return eFamily
; }
227 void InitDoc( ScDocShell
* pNewDocSh
, const OUString
& rNewName
);
229 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
231 static ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexReplace
>
232 CreateEmptyNumberingRules();
235 virtual sal_Bool SAL_CALL
isUserDefined() throw(::com::sun::star::uno::RuntimeException
);
236 virtual sal_Bool SAL_CALL
isInUse() throw(::com::sun::star::uno::RuntimeException
);
237 virtual OUString SAL_CALL
getParentStyle() throw(::com::sun::star::uno::RuntimeException
);
238 virtual void SAL_CALL
setParentStyle( const OUString
& aParentStyle
)
239 throw(::com::sun::star::container::NoSuchElementException
,
240 ::com::sun::star::uno::RuntimeException
);
243 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
244 virtual void SAL_CALL
setName( const OUString
& aName
)
245 throw(::com::sun::star::uno::RuntimeException
);
248 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
249 SAL_CALL
getPropertySetInfo()
250 throw(::com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
252 const ::com::sun::star::uno::Any
& aValue
)
253 throw(::com::sun::star::beans::UnknownPropertyException
,
254 ::com::sun::star::beans::PropertyVetoException
,
255 ::com::sun::star::lang::IllegalArgumentException
,
256 ::com::sun::star::lang::WrappedTargetException
,
257 ::com::sun::star::uno::RuntimeException
);
258 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
259 const OUString
& PropertyName
)
260 throw(::com::sun::star::beans::UnknownPropertyException
,
261 ::com::sun::star::lang::WrappedTargetException
,
262 ::com::sun::star::uno::RuntimeException
);
263 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
264 const ::com::sun::star::uno::Reference
<
265 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
266 throw(::com::sun::star::beans::UnknownPropertyException
,
267 ::com::sun::star::lang::WrappedTargetException
,
268 ::com::sun::star::uno::RuntimeException
);
269 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
270 const ::com::sun::star::uno::Reference
<
271 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
272 throw(::com::sun::star::beans::UnknownPropertyException
,
273 ::com::sun::star::lang::WrappedTargetException
,
274 ::com::sun::star::uno::RuntimeException
);
275 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
276 const ::com::sun::star::uno::Reference
<
277 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
278 throw(::com::sun::star::beans::UnknownPropertyException
,
279 ::com::sun::star::lang::WrappedTargetException
,
280 ::com::sun::star::uno::RuntimeException
);
281 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
282 const ::com::sun::star::uno::Reference
<
283 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
284 throw(::com::sun::star::beans::UnknownPropertyException
,
285 ::com::sun::star::lang::WrappedTargetException
,
286 ::com::sun::star::uno::RuntimeException
);
289 virtual void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
290 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aValues
)
291 throw (::com::sun::star::beans::PropertyVetoException
,
292 ::com::sun::star::lang::IllegalArgumentException
,
293 ::com::sun::star::lang::WrappedTargetException
,
294 ::com::sun::star::uno::RuntimeException
);
295 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
296 getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
297 throw (::com::sun::star::uno::RuntimeException
);
298 virtual void SAL_CALL
addPropertiesChangeListener( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
299 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
300 throw (::com::sun::star::uno::RuntimeException
);
301 virtual void SAL_CALL
removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
302 throw (::com::sun::star::uno::RuntimeException
);
303 virtual void SAL_CALL
firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
,
304 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
305 throw (::com::sun::star::uno::RuntimeException
);
308 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState(
309 const OUString
& PropertyName
)
310 throw(::com::sun::star::beans::UnknownPropertyException
,
311 ::com::sun::star::uno::RuntimeException
);
312 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
313 getPropertyStates( const ::com::sun::star::uno::Sequence
<
314 OUString
>& aPropertyName
)
315 throw(::com::sun::star::beans::UnknownPropertyException
,
316 ::com::sun::star::uno::RuntimeException
);
317 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
)
318 throw(::com::sun::star::beans::UnknownPropertyException
,
319 ::com::sun::star::uno::RuntimeException
);
320 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
321 const OUString
& aPropertyName
)
322 throw(::com::sun::star::beans::UnknownPropertyException
,
323 ::com::sun::star::lang::WrappedTargetException
,
324 ::com::sun::star::uno::RuntimeException
);
326 // XMultiPropertyStates
327 // getPropertyStates already defined for XPropertyState
328 virtual void SAL_CALL
setAllPropertiesToDefault() throw (::com::sun::star::uno::RuntimeException
);
329 virtual void SAL_CALL
setPropertiesToDefault( const ::com::sun::star::uno::Sequence
<
330 OUString
>& aPropertyNames
)
331 throw (::com::sun::star::beans::UnknownPropertyException
,
332 ::com::sun::star::uno::RuntimeException
);
333 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
334 getPropertyDefaults( const ::com::sun::star::uno::Sequence
<
335 OUString
>& aPropertyNames
)
336 throw (::com::sun::star::beans::UnknownPropertyException
,
337 ::com::sun::star::lang::WrappedTargetException
,
338 ::com::sun::star::uno::RuntimeException
);
341 virtual OUString SAL_CALL
getImplementationName()
342 throw(::com::sun::star::uno::RuntimeException
);
343 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
344 throw(::com::sun::star::uno::RuntimeException
);
345 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
346 throw(::com::sun::star::uno::RuntimeException
);
349 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
350 sal_Int8
>& aIdentifier
)
351 throw(::com::sun::star::uno::RuntimeException
);
353 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
354 static ScStyleObj
* getImplementation( const ::com::sun::star::uno::Reference
<
355 ::com::sun::star::uno::XInterface
> xObj
);
361 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */