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: unostyle.hxx,v $
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 ************************************************************************/
33 #ifndef _SFXSTYLE_HXX //autogen
34 #include <bf_svtools/style.hxx>
36 #ifndef _SFXLSTNER_HXX //autogen
37 #include <bf_svtools/lstner.hxx>
40 #include <unocoll.hxx>
45 #ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
46 #include <com/sun/star/style/XStyle.hpp>
48 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
49 #include <com/sun/star/lang/XUnoTunnel.hpp>
51 #ifndef _COM_SUN_STAR_STYLE_XSTYLELOADER_HPP_
52 #include <com/sun/star/style/XStyleLoader.hpp>
54 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
55 #include <com/sun/star/container/XNameContainer.hpp>
57 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
58 #include <com/sun/star/beans/XPropertySet.hpp>
60 #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
61 #include <com/sun/star/beans/XMultiPropertySet.hpp>
63 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
64 #include <com/sun/star/beans/XPropertyState.hpp>
66 #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSTATES_HPP_
67 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
69 #ifndef _CPPUHELPER_IMPLBASE7_HXX_
70 #include <cppuhelper/implbase7.hxx>
72 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP_
73 #include <com/sun/star/document/XEventsSupplier.hpp>
79 struct SfxItemPropertyMap
;
84 class SwStyleProperties_Impl
;
86 /******************************************************************************
88 ******************************************************************************/
89 /*-----------------12.02.98 08:27-------------------
91 --------------------------------------------------*/
92 class SwXStyleFamilies
: public cppu::WeakImplHelper4
94 ::com::sun::star::container::XIndexAccess
,
95 ::com::sun::star::container::XNameAccess
,
96 ::com::sun::star::lang::XServiceInfo
,
97 ::com::sun::star::style::XStyleLoader
99 public SwUnoCollection
101 SwDocShell
* pDocShell
;
103 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> * pxCharStyles
;
104 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> * pxParaStyles
;
105 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> * pxFrameStyles
;
106 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> * pxPageStyles
;
107 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> * pxNumberingStyles
;
109 virtual ~SwXStyleFamilies();
111 SwXStyleFamilies(SwDocShell
& rDocShell
);
115 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
116 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
117 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::uno::RuntimeException
);
120 virtual sal_Int32 SAL_CALL
getCount(void) throw( ::com::sun::star::uno::RuntimeException
);
121 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
124 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw(::com::sun::star::uno::RuntimeException
);
125 virtual sal_Bool SAL_CALL
hasElements( ) throw(::com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
loadStylesFromURL(const ::rtl::OUString
& rURL
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aOptions
) throw( ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
129 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
getStyleLoaderOptions(void) throw( ::com::sun::star::uno::RuntimeException
);
133 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
134 virtual BOOL SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
135 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
138 /* -----------------26.05.98 10:56-------------------
140 * --------------------------------------------------*/
141 class SwXStyleFamily
: public cppu::WeakImplHelper3
143 ::com::sun::star::container::XNameContainer
,
144 ::com::sun::star::lang::XServiceInfo
,
145 ::com::sun::star::container::XIndexAccess
149 SfxStyleFamily eFamily
; // Familie
150 SfxStyleSheetBasePool
* pBasePool
;
151 // const SfxItemPropertyMap* _pPropMap;
152 SwDocShell
* pDocShell
;
154 SwXStyle
* _FindStyle(const String
& rStyleName
) const;
156 SwXStyleFamily(SwDocShell
* pDocShell
, sal_uInt16 nFamily
);
160 virtual sal_Int32 SAL_CALL
getCount(void) throw( ::com::sun::star::uno::RuntimeException
);
161 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
164 virtual ::com::sun::star::uno::Type SAL_CALL SAL_CALL
getElementType( ) throw(::com::sun::star::uno::RuntimeException
);
165 virtual sal_Bool SAL_CALL SAL_CALL
hasElements( ) throw(::com::sun::star::uno::RuntimeException
);
168 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
169 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
170 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::uno::RuntimeException
);
173 virtual void SAL_CALL
insertByName(const ::rtl::OUString
& Name
, const ::com::sun::star::uno::Any
& Element
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
174 virtual void SAL_CALL
replaceByName(const ::rtl::OUString
& Name
, const ::com::sun::star::uno::Any
& Element
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
175 virtual void SAL_CALL
removeByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
178 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
181 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
182 virtual BOOL SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
183 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
185 /* -----------------20.05.98 09:51-------------------
187 * --------------------------------------------------*/
188 class SwXStyle
: public cppu::WeakImplHelper7
190 ::com::sun::star::style::XStyle
,
191 ::com::sun::star::beans::XPropertySet
,
192 ::com::sun::star::beans::XMultiPropertySet
,
193 ::com::sun::star::lang::XServiceInfo
,
194 ::com::sun::star::lang::XUnoTunnel
,
195 ::com::sun::star::beans::XPropertyState
,
196 ::com::sun::star::beans::XMultiPropertyStates
201 friend class SwXStyleFamily
;
204 SfxStyleSheetBasePool
* pBasePool
;
205 SfxStyleFamily eFamily
; // fuer Notify
207 sal_Bool bIsDescriptor
: 1;
208 sal_Bool bIsConditional
: 1;
209 String sParentStyleName
;
210 SwStyleProperties_Impl
* pPropImpl
;
212 void ApplyDescriptorProperties();
216 const SfxStyleSheetBasePool
* GetBasePool() const {return pBasePool
;}
217 SfxStyleSheetBasePool
* GetBasePool() {return pBasePool
;}
219 void SetStyleName(const String
& rSet
){ sStyleName
= rSet
;}
220 SwStyleProperties_Impl
* GetPropImpl(){return pPropImpl
;}
221 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> mxStyleData
;
222 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> mxStyleFamily
;
225 SwXStyle(SwDoc
* pDoc
, SfxStyleFamily eFam
= SFX_STYLE_FAMILY_PARA
, BOOL bConditional
= FALSE
);
226 SwXStyle(SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFam
,
228 const String
& rStyleName
);//,
229 //const SfxItemPropertyMap* _pMap);
234 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
237 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
240 virtual ::rtl::OUString SAL_CALL
getName(void) throw( ::com::sun::star::uno::RuntimeException
);
241 virtual void SAL_CALL
setName(const ::rtl::OUString
& Name_
) throw( ::com::sun::star::uno::RuntimeException
);
244 virtual sal_Bool SAL_CALL
isUserDefined(void) throw( ::com::sun::star::uno::RuntimeException
);
245 virtual sal_Bool SAL_CALL
isInUse(void) throw( ::com::sun::star::uno::RuntimeException
);
246 virtual ::rtl::OUString SAL_CALL
getParentStyle(void) throw( ::com::sun::star::uno::RuntimeException
);
247 virtual void SAL_CALL
setParentStyle(const ::rtl::OUString
& aParentStyle
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
);
250 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) 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
);
252 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
253 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
254 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
255 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
256 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
259 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
260 virtual void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aValues
) throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
261 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw(::com::sun::star::uno::RuntimeException
);
262 virtual void SAL_CALL
addPropertiesChangeListener( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
263 virtual void SAL_CALL
removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
264 virtual void SAL_CALL
firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
267 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
268 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
getPropertyStates( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
269 virtual void SAL_CALL
setPropertyToDefault( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
270 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault( const ::rtl::OUString
& aPropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
272 //XMultiPropertyStates
273 //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
274 virtual void SAL_CALL
setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException
);
275 virtual void SAL_CALL
setPropertiesToDefault( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
276 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyDefaults( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
279 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
280 virtual BOOL SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
281 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
284 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
286 const String
& GetStyleName() const { return sStyleName
;}
287 SfxStyleFamily
GetFamily() const {return eFamily
;}
289 sal_Bool
IsDescriptor() const {return bIsDescriptor
;}
290 sal_Bool
IsConditional() const { return bIsConditional
;}
291 const String
& GetParentStyleName() const { return sParentStyleName
;}
292 void SetDoc(SwDoc
* pDc
, SfxStyleSheetBasePool
* pPool
)
294 bIsDescriptor
= sal_False
; m_pDoc
= pDc
;
296 StartListening(*pBasePool
);
298 SwDoc
* GetDoc() const { return m_pDoc
; }
299 virtual void Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
);
301 /* -----------------------------15.12.00 14:25--------------------------------
303 ---------------------------------------------------------------------------*/
304 class SwXFrameStyle
: public SwXStyle
,
305 public ::com::sun::star::document::XEventsSupplier
308 SwXFrameStyle(SfxStyleSheetBasePool
& rPool
,
310 const String
& rStyleName
) :
311 SwXStyle(rPool
, SFX_STYLE_FAMILY_FRAME
, pDoc
, rStyleName
){}
312 SwXFrameStyle( SwDoc
*pDoc
);
315 virtual void SAL_CALL
acquire( ) throw(){SwXStyle::acquire();}
316 virtual void SAL_CALL
release( ) throw(){SwXStyle::release();}
318 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
319 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
) throw(::com::sun::star::uno::RuntimeException
);
321 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents( ) throw(::com::sun::star::uno::RuntimeException
);
323 friend class SwFrameStyleEventDescriptor
;
325 /* -----------------24.08.98 16:04-------------------
327 * --------------------------------------------------*/
328 class SwXPageStyle
: public SwXStyle
330 SwDocShell
* pDocShell
;
332 SwXPageStyle(SfxStyleSheetBasePool
& rPool
, SwDocShell
* pDocSh
, SfxStyleFamily eFam
,
333 const String
& rStyleName
);//,
334 //const SfxItemPropertyMap* _pMap);
335 SwXPageStyle(SwDocShell
* pDocSh
);
338 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) 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
);
339 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
341 virtual void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aValues
) throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
342 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw(::com::sun::star::uno::RuntimeException
);
345 } //namespace binfilter