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(); 65 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 66 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 67 68 // XNamed 69 virtual ::rtl::OUString SAL_CALL getName( ); 70 virtual void SAL_CALL setName( const ::rtl::OUString& aName ); 71 72 // XNameAccess 73 virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ); 74 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(); 75 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ); 76 77 // XElementAccess 78 virtual css::uno::Type SAL_CALL getElementType(); 79 virtual sal_Bool SAL_CALL hasElements(); 80 81 // XIndexAccess 82 virtual sal_Int32 SAL_CALL getCount() ; 83 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ); 84 85 // XNameContainer 86 virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ); 87 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ); 88 89 // XNameReplace 90 virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ); 91 92 // XSingleServiceFactory 93 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ); 94 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ); 95 96 // XComponent 97 virtual void SAL_CALL dispose( ); 98 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ); 99 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ); 100 101 // XPropertySet 102 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo(); 103 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ); 104 virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 105 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener ); 106 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener ); 107 virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener ); 108 virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& PropertyName,const css::uno::Reference<css::beans::XVetoableChangeListener>&aListener ); 109 110 private: 111 void throwIfDisposed() const; 112 SdStyleSheet* GetValidNewSheet( const css::uno::Any& rElement ); 113 SdStyleSheet* GetSheetByName( const ::rtl::OUString& rName ); 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