xref: /aoo41x/main/sd/inc/stlsheet.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SD_STLSHEET_HXX
29 #define _SD_STLSHEET_HXX
30 
31 #include <rtl/ref.hxx>
32 
33 #include <com/sun/star/style/XStyle.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/beans/XPropertyState.hpp>
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/util/XModifyBroadcaster.hpp>
39 
40 #include <cppuhelper/interfacecontainer.h>
41 #include <cppuhelper/implbase5.hxx>
42 #include <cppuhelper/basemutex.hxx>
43 
44 #include <svl/style.hxx>
45 
46 #include <editeng/unoipset.hxx>
47 
48 #include <boost/scoped_ptr.hpp>
49 
50 class ModifyListenerForewarder;
51 
52 typedef cppu::ImplInheritanceHelper5< SfxUnoStyleSheet,
53 									::com::sun::star::beans::XPropertySet,
54 									::com::sun::star::lang::XServiceInfo,
55 									::com::sun::star::beans::XPropertyState,
56 									::com::sun::star::util::XModifyBroadcaster,
57 									::com::sun::star::lang::XComponent > SdStyleSheetBase ;
58 
59 class SdStyleSheet : public SdStyleSheetBase, private ::cppu::BaseMutex
60 {
61 public:
62 	SdStyleSheet( const rtl::OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask );
63 	SdStyleSheet( const SdStyleSheet& );
64 
65 	virtual sal_Bool		SetParent (const String& rParentName);
66 	virtual SfxItemSet& GetItemSet();
67 	virtual sal_Bool		IsUsed() const;
68 	virtual sal_Bool		HasFollowSupport() const;
69 	virtual sal_Bool		HasParentSupport() const;
70 	virtual sal_Bool		HasClearParentSupport() const;
71 	virtual sal_Bool		SetName( const UniString& );
72 	virtual void		SetHelpId( const String& r, sal_uLong nId );
73 
74 	void        AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems = sal_True);
75 
76 	SdStyleSheet* GetRealStyleSheet() const;
77 	SdStyleSheet* GetPseudoStyleSheet() const;
78 
79 	void SetApiName( const ::rtl::OUString& rApiName );
80 	rtl::OUString GetApiName() const;
81 
82 	static rtl::OUString GetFamilyString( SfxStyleFamily eFamily );
83 
84 	static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
85 
86 	// XInterface
87     virtual void SAL_CALL release(  ) throw ();
88 
89     // XServiceInfo
90     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
91     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
92     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
93 
94 	// XNamed
95     virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
96     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
97 
98 	// XStyle
99     virtual sal_Bool SAL_CALL isUserDefined(  ) throw(::com::sun::star::uno::RuntimeException);
100     virtual sal_Bool SAL_CALL isInUse(  ) throw(::com::sun::star::uno::RuntimeException);
101     virtual ::rtl::OUString SAL_CALL getParentStyle(  ) throw(::com::sun::star::uno::RuntimeException);
102     virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
103 
104 	// XPropertySet
105     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
106     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);
107     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);
108     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);
109     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);
110     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);
111     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);
112 
113 	// XPropertyState
114     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
115     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);
116     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
117     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);
118 
119 	// XModifyBroadcaster
120 	virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
121     virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
122 
123 	// XComponent
124     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
125     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
126 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
127 
128 	void notifyModifyListener();
129 
130 protected:
131 	const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw();
132 
133 	virtual void Load (SvStream& rIn, sal_uInt16 nVersion);
134 	virtual void Store(SvStream& rOut);
135 
136 	virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
137 	virtual 			~SdStyleSheet();
138 
139 	void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException);
140 
141 	virtual void disposing();
142 
143 	rtl::OUString	msApiName;
144 	rtl::Reference< SfxStyleSheetBasePool > mxPool;
145 
146     /** boradcast helper for events */
147     ::cppu::OBroadcastHelper mrBHelper;
148 
149 	boost::scoped_ptr< ModifyListenerForewarder > mpModifyListenerForewarder;
150 
151 private:
152 	SdStyleSheet& operator=( const SdStyleSheet& );	// not implemented
153 };
154 
155 typedef rtl::Reference< SdStyleSheet > SdStyleSheetRef;
156 typedef std::vector< SdStyleSheetRef > SdStyleSheetVector;
157 
158 #endif	   // _SD_STLSHEET_HXX
159 
160 
161 
162