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_STLFAMILY_HXX 29 #define _SD_STLFAMILY_HXX 30 31 #include <com/sun/star/uno/Any.hxx> 32 #include <com/sun/star/style/XStyle.hpp> 33 #include <com/sun/star/beans/XPropertySet.hpp> 34 #include <com/sun/star/lang/XServiceInfo.hpp> 35 #include <com/sun/star/beans/XPropertyState.hpp> 36 #include <com/sun/star/lang/XComponent.hpp> 37 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 38 #include <com/sun/star/container/XIndexAccess.hpp> 39 #include <com/sun/star/container/XNameContainer.hpp> 40 #include <com/sun/star/container/XNamed.hpp> 41 42 #include <rtl/ref.hxx> 43 44 #include <cppuhelper/implbase7.hxx> 45 46 #include <svl/style.hxx> 47 48 #include <editeng/unoipset.hxx> 49 50 class SdStyleSheet; 51 class SdPage; 52 struct SdStyleFamilyImpl; 53 54 namespace css = ::com::sun::star; 55 56 class SdStyleFamily : public ::cppu::WeakImplHelper7< css::container::XNameContainer, css::container::XNamed, css::container::XIndexAccess, css::lang::XSingleServiceFactory, css::lang::XServiceInfo, css::lang::XComponent, css::beans::XPropertySet > 57 { 58 public: 59 /// creates the style family for the given SfxStyleFamily 60 SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, SfxStyleFamily nFamily ); 61 62 /// creates the presentation family for the given masterpage 63 SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, const SdPage* pMasterPage ); 64 65 virtual ~SdStyleFamily(); 66 67 // XServiceInfo 68 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException); 69 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(css::uno::RuntimeException); 70 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException); 71 72 // XNamed 73 virtual ::rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException); 74 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); 75 76 // XNameAccess 77 virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); 78 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(css::uno::RuntimeException); 79 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(css::uno::RuntimeException); 80 81 // XElementAccess 82 virtual css::uno::Type SAL_CALL getElementType() throw(css::uno::RuntimeException); 83 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException); 84 85 // XIndexAccess 86 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException) ; 87 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException); 88 89 // XNameContainer 90 virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException); 91 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); 92 93 // XNameReplace 94 virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); 95 96 // XSingleServiceFactory 97 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ) throw(css::uno::Exception, css::uno::RuntimeException); 98 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) throw(css::uno::Exception, css::uno::RuntimeException); 99 100 // XComponent 101 virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException); 102 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException); 103 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException); 104 105 // XPropertySet 106 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (css::uno::RuntimeException); 107 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException); 108 virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 109 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 110 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 111 virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 112 virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& PropertyName,const css::uno::Reference<css::beans::XVetoableChangeListener>&aListener ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 113 114 private: 115 void throwIfDisposed() const throw(css::uno::RuntimeException); 116 SdStyleSheet* GetValidNewSheet( const css::uno::Any& rElement ) throw(css::lang::IllegalArgumentException); 117 SdStyleSheet* GetSheetByName( const ::rtl::OUString& rName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException ); 118 119 SfxStyleFamily mnFamily; 120 rtl::Reference< SfxStyleSheetPool > mxPool; 121 SdStyleFamilyImpl* mpImpl; 122 }; 123 124 typedef rtl::Reference< SdStyleFamily > SdStyleFamilyRef; 125 126 #endif // _SD_STLFAMILY_HXX 127