1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SD_STLFAMILY_HXX 25 #define _SD_STLFAMILY_HXX 26 27 #include <com/sun/star/uno/Any.hxx> 28 #include <com/sun/star/style/XStyle.hpp> 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 #include <com/sun/star/lang/XServiceInfo.hpp> 31 #include <com/sun/star/beans/XPropertyState.hpp> 32 #include <com/sun/star/lang/XComponent.hpp> 33 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34 #include <com/sun/star/container/XIndexAccess.hpp> 35 #include <com/sun/star/container/XNameContainer.hpp> 36 #include <com/sun/star/container/XNamed.hpp> 37 38 #include <rtl/ref.hxx> 39 40 #include <cppuhelper/implbase7.hxx> 41 42 #include <svl/style.hxx> 43 44 #include <editeng/unoipset.hxx> 45 46 class SdStyleSheet; 47 class SdPage; 48 struct SdStyleFamilyImpl; 49 50 namespace css = ::com::sun::star; 51 52 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 > 53 { 54 public: 55 /// creates the style family for the given SfxStyleFamily 56 SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, SfxStyleFamily nFamily ); 57 58 /// creates the presentation family for the given masterpage 59 SdStyleFamily( const rtl::Reference< SfxStyleSheetPool >& xPool, const SdPage* pMasterPage ); 60 61 virtual ~SdStyleFamily(); 62 63 // XServiceInfo 64 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException); 65 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(css::uno::RuntimeException); 66 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException); 67 68 // XNamed 69 virtual ::rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException); 70 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); 71 72 // XNameAccess 73 virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); 74 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(css::uno::RuntimeException); 75 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(css::uno::RuntimeException); 76 77 // XElementAccess 78 virtual css::uno::Type SAL_CALL getElementType() throw(css::uno::RuntimeException); 79 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException); 80 81 // XIndexAccess 82 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException) ; 83 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException); 84 85 // XNameContainer 86 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); 87 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); 88 89 // XNameReplace 90 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); 91 92 // XSingleServiceFactory 93 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ) throw(css::uno::Exception, css::uno::RuntimeException); 94 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); 95 96 // XComponent 97 virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException); 98 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException); 99 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException); 100 101 // XPropertySet 102 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (css::uno::RuntimeException); 103 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); 104 virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException); 105 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); 106 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); 107 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); 108 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); 109 110 private: 111 void throwIfDisposed() const throw(css::uno::RuntimeException); 112 SdStyleSheet* GetValidNewSheet( const css::uno::Any& rElement ) throw(css::lang::IllegalArgumentException); 113 SdStyleSheet* GetSheetByName( const ::rtl::OUString& rName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException ); 114 115 SfxStyleFamily mnFamily; 116 rtl::Reference< SfxStyleSheetPool > mxPool; 117 SdStyleFamilyImpl* mpImpl; 118 }; 119 120 typedef rtl::Reference< SdStyleFamily > SdStyleFamilyRef; 121 122 #endif // _SD_STLFAMILY_HXX 123