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