1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SD_STLPROPERTYSET_HXX 25cdf0e10cSrcweir #define _SD_STLPROPERTYSET_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifndef _UTL_STLTYPES_HXX_ 30cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <list> 34cdf0e10cSrcweir #include <map> 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace sd 37cdf0e10cSrcweir { 38cdf0e10cSrcweir 39cdf0e10cSrcweir const sal_Int32 STLPropertyState_DEFAULT = 0; 40cdf0e10cSrcweir const sal_Int32 STLPropertyState_DIRECT = 1; 41cdf0e10cSrcweir const sal_Int32 STLPropertyState_AMBIGUOUS = 3; 42cdf0e10cSrcweir 43cdf0e10cSrcweir struct STLPropertyMapEntry 44cdf0e10cSrcweir { 45cdf0e10cSrcweir ::com::sun::star::uno::Any maValue; 46cdf0e10cSrcweir sal_Int32 mnState; 47cdf0e10cSrcweir 48cdf0e10cSrcweir STLPropertyMapEntry() 49cdf0e10cSrcweir : mnState( STLPropertyState_AMBIGUOUS ) {} 50cdf0e10cSrcweir STLPropertyMapEntry( ::com::sun::star::uno::Any aValue, sal_Int32 nState = STLPropertyState_DEFAULT ) 51cdf0e10cSrcweir : maValue( aValue ), mnState( nState ) {} 52cdf0e10cSrcweir 53cdf0e10cSrcweir }; 54cdf0e10cSrcweir 55cdf0e10cSrcweir typedef std::map<sal_Int32, STLPropertyMapEntry > PropertyMap; 56cdf0e10cSrcweir typedef PropertyMap::iterator PropertyMapIter; 57cdf0e10cSrcweir typedef PropertyMap::const_iterator PropertyMapConstIter; 58cdf0e10cSrcweir 59cdf0e10cSrcweir class STLPropertySet 60cdf0e10cSrcweir { 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir STLPropertySet(); 63cdf0e10cSrcweir ~STLPropertySet(); 64cdf0e10cSrcweir 65cdf0e10cSrcweir void setPropertyDefaultValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ); 66cdf0e10cSrcweir void setPropertyValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue, sal_Int32 nState = STLPropertyState_DIRECT ); 67cdf0e10cSrcweir ::com::sun::star::uno::Any getPropertyValue( sal_Int32 nHandle ) const; 68cdf0e10cSrcweir 69cdf0e10cSrcweir sal_Int32 getPropertyState( sal_Int32 nHandle ) const; 70cdf0e10cSrcweir void setPropertyState( sal_Int32 nHandle, sal_Int32 nState ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir private: 73cdf0e10cSrcweir bool findProperty( sal_Int32 nHandle, PropertyMapIter& rIter ); 74cdf0e10cSrcweir bool findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const; 75cdf0e10cSrcweir 76cdf0e10cSrcweir private: 77cdf0e10cSrcweir PropertyMap maPropertyMap; 78cdf0e10cSrcweir }; 79cdf0e10cSrcweir 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir #endif // _SD_STLPROPERTYSET_HXX 83