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 PROPERTYSTORAGE_HXX 25 #define PROPERTYSTORAGE_HXX 26 27 /** === begin UNO includes === **/ 28 #include <com/sun/star/uno/Any.hxx> 29 /** === end UNO includes === **/ 30 31 #include <tools/solar.h> 32 33 #include <boost/shared_ptr.hpp> 34 #include <map> 35 36 class SfxItemSet; 37 38 //........................................................................ 39 namespace dbaui 40 { 41 //........................................................................ 42 43 //==================================================================== 44 //= PropertyStorage 45 //==================================================================== 46 class SAL_NO_VTABLE PropertyStorage 47 { 48 public: 49 virtual void getPropertyValue( ::com::sun::star::uno::Any& _out_rValue ) const = 0; 50 virtual void setPropertyValue( const ::com::sun::star::uno::Any& _rValue ) = 0; 51 52 virtual ~PropertyStorage(); 53 }; 54 55 typedef ::boost::shared_ptr< PropertyStorage > PPropertyStorage; 56 typedef ::std::map< sal_Int32, PPropertyStorage > PropertyValues; 57 58 //==================================================================== 59 //= SetItemPropertyStorage 60 //==================================================================== 61 typedef sal_uInt16 ItemId; 62 63 /** a PropertyStorage implementation which stores the value in an item set 64 */ 65 class SetItemPropertyStorage : public PropertyStorage 66 { 67 public: SetItemPropertyStorage(SfxItemSet & _rItemSet,const ItemId _nItemID)68 SetItemPropertyStorage( SfxItemSet& _rItemSet, const ItemId _nItemID ) 69 :m_rItemSet( _rItemSet ) 70 ,m_nItemID( _nItemID ) 71 { 72 } 73 ~SetItemPropertyStorage()74 virtual ~SetItemPropertyStorage() 75 { 76 } 77 78 virtual void getPropertyValue( ::com::sun::star::uno::Any& _out_rValue ) const; 79 virtual void setPropertyValue( const ::com::sun::star::uno::Any& _rValue ); 80 81 private: 82 SfxItemSet& m_rItemSet; 83 const ItemId m_nItemID; 84 }; 85 86 //........................................................................ 87 } // namespace dbaui 88 //........................................................................ 89 90 #endif // PROPERTYSTORAGE_HXX 91