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: stlsheet.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 _SD_STLSHEET_HXX
32 #define _SD_STLSHEET_HXX
34 #include <rtl/ref.hxx>
36 #include <com/sun/star/style/XStyle.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/beans/XPropertyState.hpp>
40 #include <com/sun/star/lang/XComponent.hpp>
41 #include <com/sun/star/util/XModifyBroadcaster.hpp>
43 #include <cppuhelper/interfacecontainer.h>
44 #include <cppuhelper/implbase5.hxx>
45 #include <cppuhelper/basemutex.hxx>
47 #include <svtools/style.hxx>
49 #include <svx/unoipset.hxx>
51 #include <boost/scoped_ptr.hpp>
53 class ModifyListenerForewarder
;
55 typedef cppu::ImplInheritanceHelper5
< SfxUnoStyleSheet
,
56 ::com::sun::star::beans::XPropertySet
,
57 ::com::sun::star::lang::XServiceInfo
,
58 ::com::sun::star::beans::XPropertyState
,
59 ::com::sun::star::util::XModifyBroadcaster
,
60 ::com::sun::star::lang::XComponent
> SdStyleSheetBase
;
62 class SdStyleSheet
: public SdStyleSheetBase
, private ::cppu::BaseMutex
65 SdStyleSheet( const rtl::OUString
& rDisplayName
, SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
, USHORT nMask
);
66 SdStyleSheet( const SdStyleSheet
& );
68 virtual BOOL
SetParent (const String
& rParentName
);
69 virtual SfxItemSet
& GetItemSet();
70 virtual BOOL
IsUsed() const;
71 virtual BOOL
HasFollowSupport() const;
72 virtual BOOL
HasParentSupport() const;
73 virtual BOOL
HasClearParentSupport() const;
74 virtual BOOL
SetName( const UniString
& );
75 virtual void SetHelpId( const String
& r
, ULONG nId
);
77 void AdjustToFontHeight(SfxItemSet
& rSet
, BOOL bOnlyMissingItems
= TRUE
);
79 SdStyleSheet
* GetRealStyleSheet() const;
80 SdStyleSheet
* GetPseudoStyleSheet() const;
82 void SetApiName( const ::rtl::OUString
& rApiName
);
83 rtl::OUString
GetApiName() const;
85 static rtl::OUString
GetFamilyString( SfxStyleFamily eFamily
);
87 static SdStyleSheet
* CreateEmptyUserStyle( SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
);
90 virtual void SAL_CALL
release( ) throw ();
93 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
94 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
95 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
98 virtual ::rtl::OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
isUserDefined( ) throw(::com::sun::star::uno::RuntimeException
);
103 virtual sal_Bool SAL_CALL
isInUse( ) throw(::com::sun::star::uno::RuntimeException
);
104 virtual ::rtl::OUString SAL_CALL
getParentStyle( ) throw(::com::sun::star::uno::RuntimeException
);
105 virtual void SAL_CALL
setParentStyle( const ::rtl::OUString
& aParentStyle
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
);
109 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
);
110 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
);
111 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
);
112 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
);
113 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
);
114 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
);
117 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
118 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
);
119 virtual void SAL_CALL
setPropertyToDefault( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
120 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
);
122 // XModifyBroadcaster
123 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
124 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
127 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
129 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
131 void notifyModifyListener();
134 const SfxItemPropertySimpleEntry
* getPropertyMapEntry( const ::rtl::OUString
& rPropertyName
) const throw();
136 virtual void Load (SvStream
& rIn
, USHORT nVersion
);
137 virtual void Store(SvStream
& rOut
);
139 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
140 virtual ~SdStyleSheet();
142 void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException
);
144 virtual void disposing();
146 rtl::OUString msApiName
;
147 rtl::Reference
< SfxStyleSheetBasePool
> mxPool
;
149 /** boradcast helper for events */
150 ::cppu::OBroadcastHelper mrBHelper
;
152 boost::scoped_ptr
< ModifyListenerForewarder
> mpModifyListenerForewarder
;
155 SdStyleSheet
& operator=( const SdStyleSheet
& ); // not implemented
158 typedef rtl::Reference
< SdStyleSheet
> SdStyleSheetRef
;
159 typedef std::vector
< SdStyleSheetRef
> SdStyleSheetVector
;
161 #endif // _SD_STLSHEET_HXX