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 _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX 25 #define _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX 26 27 #include <com/sun/star/beans/XPropertySet.hpp> 28 29 #include <hash_map> 30 #include <xmloff/PropertySetInfoHash.hxx> 31 32 typedef std::hash_map 33 < 34 PropertySetInfoKey, 35 sal_Bool, 36 PropertySetInfoHash, 37 PropertySetInfoHash 38 > 39 SinglePropertySetInfoMap_Impl; 40 41 class SinglePropertySetInfoCache : private SinglePropertySetInfoMap_Impl 42 { 43 ::rtl::OUString sName; 44 45 public: 46 47 inline SinglePropertySetInfoCache( const ::rtl::OUString& rName ); ~SinglePropertySetInfoCache()48 ~SinglePropertySetInfoCache() {}; 49 50 sal_Bool hasProperty( 51 const ::com::sun::star::uno::Reference< 52 ::com::sun::star::beans::XPropertySet >& rPropSet, 53 ::com::sun::star::uno::Reference< 54 ::com::sun::star::beans::XPropertySetInfo >& rPropSetInfo ); 55 inline sal_Bool hasProperty( 56 const ::com::sun::star::uno::Reference< 57 ::com::sun::star::beans::XPropertySet>& rPropSet ); 58 }; 59 SinglePropertySetInfoCache(const::rtl::OUString & rName)60inline SinglePropertySetInfoCache::SinglePropertySetInfoCache( 61 const ::rtl::OUString& rName ) : 62 sName( rName ) 63 { 64 } 65 hasProperty(const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> & rPropSet)66inline sal_Bool SinglePropertySetInfoCache::hasProperty( 67 const ::com::sun::star::uno::Reference< 68 ::com::sun::star::beans::XPropertySet>& rPropSet ) 69 { 70 ::com::sun::star::uno::Reference< 71 ::com::sun::star::beans::XPropertySetInfo > xInfo; 72 return hasProperty( rPropSet, xInfo ); 73 } 74 75 #endif 76