1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SD_STLPROPERTYSET_HXX 29 #define _SD_STLPROPERTYSET_HXX 30 31 #include <com/sun/star/beans/PropertyValue.hpp> 32 33 #ifndef _UTL_STLTYPES_HXX_ 34 #include <comphelper/stl_types.hxx> 35 #endif 36 37 #include <list> 38 #include <map> 39 40 namespace sd 41 { 42 43 const sal_Int32 STLPropertyState_DEFAULT = 0; 44 const sal_Int32 STLPropertyState_DIRECT = 1; 45 const sal_Int32 STLPropertyState_AMBIGUOUS = 3; 46 47 struct STLPropertyMapEntry 48 { 49 ::com::sun::star::uno::Any maValue; 50 sal_Int32 mnState; 51 52 STLPropertyMapEntry() 53 : mnState( STLPropertyState_AMBIGUOUS ) {} 54 STLPropertyMapEntry( ::com::sun::star::uno::Any aValue, sal_Int32 nState = STLPropertyState_DEFAULT ) 55 : maValue( aValue ), mnState( nState ) {} 56 57 }; 58 59 typedef std::map<sal_Int32, STLPropertyMapEntry > PropertyMap; 60 typedef PropertyMap::iterator PropertyMapIter; 61 typedef PropertyMap::const_iterator PropertyMapConstIter; 62 63 class STLPropertySet 64 { 65 public: 66 STLPropertySet(); 67 ~STLPropertySet(); 68 69 void setPropertyDefaultValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ); 70 void setPropertyValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue, sal_Int32 nState = STLPropertyState_DIRECT ); 71 ::com::sun::star::uno::Any getPropertyValue( sal_Int32 nHandle ) const; 72 73 sal_Int32 getPropertyState( sal_Int32 nHandle ) const; 74 void setPropertyState( sal_Int32 nHandle, sal_Int32 nState ); 75 76 private: 77 bool findProperty( sal_Int32 nHandle, PropertyMapIter& rIter ); 78 bool findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const; 79 80 private: 81 PropertyMap maPropertyMap; 82 }; 83 84 } 85 86 #endif // _SD_STLPROPERTYSET_HXX 87