1c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c45d927aSAndrew Rist * distributed with this work for additional information 6c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10c45d927aSAndrew Rist * 11c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12c45d927aSAndrew Rist * 13c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c45d927aSAndrew Rist * software distributed under the License is distributed on an 15c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17c45d927aSAndrew Rist * specific language governing permissions and limitations 18c45d927aSAndrew Rist * under the License. 19c45d927aSAndrew Rist * 20c45d927aSAndrew Rist *************************************************************/ 21c45d927aSAndrew Rist 22c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SD_STLSHEET_HXX 25cdf0e10cSrcweir #define _SD_STLSHEET_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <rtl/ref.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp> 30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 34cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 37cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 38cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <svl/style.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <editeng/unoipset.hxx> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 45cdf0e10cSrcweir 46cdf0e10cSrcweir class ModifyListenerForewarder; 47cdf0e10cSrcweir 48cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper5< SfxUnoStyleSheet, 49cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet, 50cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 51cdf0e10cSrcweir ::com::sun::star::beans::XPropertyState, 52cdf0e10cSrcweir ::com::sun::star::util::XModifyBroadcaster, 53cdf0e10cSrcweir ::com::sun::star::lang::XComponent > SdStyleSheetBase ; 54cdf0e10cSrcweir 55cdf0e10cSrcweir class SdStyleSheet : public SdStyleSheetBase, private ::cppu::BaseMutex 56cdf0e10cSrcweir { 57cdf0e10cSrcweir public: 58cdf0e10cSrcweir SdStyleSheet( const rtl::OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask ); 59cdf0e10cSrcweir SdStyleSheet( const SdStyleSheet& ); 60cdf0e10cSrcweir 61cdf0e10cSrcweir virtual sal_Bool SetParent (const String& rParentName); 62cdf0e10cSrcweir virtual SfxItemSet& GetItemSet(); 63cdf0e10cSrcweir virtual sal_Bool IsUsed() const; 64cdf0e10cSrcweir virtual sal_Bool HasFollowSupport() const; 65cdf0e10cSrcweir virtual sal_Bool HasParentSupport() const; 66cdf0e10cSrcweir virtual sal_Bool HasClearParentSupport() const; 67cdf0e10cSrcweir virtual sal_Bool SetName( const UniString& ); 68cdf0e10cSrcweir virtual void SetHelpId( const String& r, sal_uLong nId ); 69cdf0e10cSrcweir 70cdf0e10cSrcweir void AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems = sal_True); 71cdf0e10cSrcweir 72cdf0e10cSrcweir SdStyleSheet* GetRealStyleSheet() const; 73cdf0e10cSrcweir SdStyleSheet* GetPseudoStyleSheet() const; 74cdf0e10cSrcweir 75cdf0e10cSrcweir void SetApiName( const ::rtl::OUString& rApiName ); 76cdf0e10cSrcweir rtl::OUString GetApiName() const; 77cdf0e10cSrcweir 78cdf0e10cSrcweir static rtl::OUString GetFamilyString( SfxStyleFamily eFamily ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // XInterface 83cdf0e10cSrcweir virtual void SAL_CALL release( ) throw (); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // XServiceInfo 86cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 88cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // XNamed 91cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XStyle 95cdf0e10cSrcweir virtual sal_Bool SAL_CALL isUserDefined( ) throw(::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir virtual sal_Bool SAL_CALL isInUse( ) throw(::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getParentStyle( ) throw(::com::sun::star::uno::RuntimeException); 98cdf0e10cSrcweir virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir // XPropertySet 101cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir 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); 103cdf0e10cSrcweir 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); 104cdf0e10cSrcweir 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); 105cdf0e10cSrcweir 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); 106cdf0e10cSrcweir 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); 107cdf0e10cSrcweir 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); 108cdf0e10cSrcweir 109cdf0e10cSrcweir // XPropertyState 110cdf0e10cSrcweir virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir 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); 112cdf0e10cSrcweir virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir 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); 114cdf0e10cSrcweir 115cdf0e10cSrcweir // XModifyBroadcaster 116cdf0e10cSrcweir virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 117cdf0e10cSrcweir virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // XComponent 120cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir 124cdf0e10cSrcweir void notifyModifyListener(); 125cdf0e10cSrcweir 126cdf0e10cSrcweir protected: 127cdf0e10cSrcweir const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw(); 128cdf0e10cSrcweir 129cdf0e10cSrcweir virtual void Load (SvStream& rIn, sal_uInt16 nVersion); 130cdf0e10cSrcweir virtual void Store(SvStream& rOut); 131cdf0e10cSrcweir 132cdf0e10cSrcweir virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); 133cdf0e10cSrcweir virtual ~SdStyleSheet(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException); 136cdf0e10cSrcweir 137cdf0e10cSrcweir virtual void disposing(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir rtl::OUString msApiName; 140cdf0e10cSrcweir rtl::Reference< SfxStyleSheetBasePool > mxPool; 141cdf0e10cSrcweir 142*86e1cf34SPedro Giffuni /** broadcast helper for events */ 143cdf0e10cSrcweir ::cppu::OBroadcastHelper mrBHelper; 144cdf0e10cSrcweir 145cdf0e10cSrcweir boost::scoped_ptr< ModifyListenerForewarder > mpModifyListenerForewarder; 146cdf0e10cSrcweir 147cdf0e10cSrcweir private: 148cdf0e10cSrcweir SdStyleSheet& operator=( const SdStyleSheet& ); // not implemented 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir 151cdf0e10cSrcweir typedef rtl::Reference< SdStyleSheet > SdStyleSheetRef; 152cdf0e10cSrcweir typedef std::vector< SdStyleSheetRef > SdStyleSheetVector; 153cdf0e10cSrcweir 154cdf0e10cSrcweir #endif // _SD_STLSHEET_HXX 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158