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 _SVX_UNOPOOL_HXX_ 25 #define _SVX_UNOPOOL_HXX_ 26 27 #include <com/sun/star/lang/XServiceInfo.hpp> 28 #include <comphelper/propertysethelper.hxx> 29 #include <cppuhelper/implbase4.hxx> 30 #include "svx/svxdllapi.h" 31 32 class SdrModel; 33 class SfxItemPool; 34 35 /** This class implements the service com.sun.star.drawing.Defaults. 36 It works on the SfxItemPool from the given model and the global 37 draw object item pool. 38 The class can work in a read only mode without a model. Derivated 39 classes can set a model on demand by overiding getModelPool(). 40 */ 41 class SVX_DLLPUBLIC SvxUnoDrawPool : public ::cppu::OWeakAggObject, 42 public ::com::sun::star::lang::XServiceInfo, 43 public ::com::sun::star::lang::XTypeProvider, 44 public comphelper::PropertySetHelper 45 { 46 public: 47 SvxUnoDrawPool( SdrModel* pModel, sal_Int32 nServiceId ) throw(); 48 49 /** deprecated */ 50 SvxUnoDrawPool( SdrModel* pModel ) throw(); 51 virtual ~SvxUnoDrawPool() throw(); 52 53 /** This returns the item pool from the given model, or the default pool if there is no model and bReadOnly is true. 54 If bReadOnly is false and there is no model the default implementation returns NULL. 55 */ 56 virtual SfxItemPool* getModelPool( sal_Bool bReadOnly ) throw(); 57 58 // overiden helpers from comphelper::PropertySetHelper 59 virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); 60 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); 61 62 virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException ); 63 virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException ); 64 virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); 65 66 // XInterface 67 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 68 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 69 virtual void SAL_CALL acquire() throw(); 70 virtual void SAL_CALL release() throw(); 71 72 // XTypeProvider 73 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 74 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); 75 76 // XServiceInfo 77 virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 78 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); 79 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 80 81 protected: 82 void init(); 83 84 virtual void getAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException); 85 virtual void putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException); 86 87 protected: 88 SdrModel* mpModel; 89 SfxItemPool* mpDefaultsPool; 90 }; 91 92 #endif 93