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 #ifndef CHART_ITEMPROPERTYMAP_HXX 24 #define CHART_ITEMPROPERTYMAP_HXX 25 26 27 #include <comphelper/InlineContainer.hxx> 28 #include "ItemConverter.hxx" 29 30 31 #define IPM_MAP_ENTRY(wid,uno,mid) (wid, ::std::make_pair< ::comphelper::ItemConverter::tPropertyNameType, ::comphelper::ItemConverter::tMemberIdType >(\ 32 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(uno)), mid)) 33 34 namespace comphelper 35 { 36 37 typedef ::std::map< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > 38 ItemPropertyMapType; 39 typedef ::comphelper::MakeMap< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > 40 MakeItemPropertyMap; 41 42 class FillItemSetFunc : public ::std::unary_function< ItemConverter *, void > 43 { 44 public: FillItemSetFunc(SfxItemSet & rOutItemSet)45 explicit FillItemSetFunc( SfxItemSet & rOutItemSet ) : 46 m_rOutItemSet( rOutItemSet ) 47 {} 48 operator ()(ItemConverter * pConv)49 void operator() ( ItemConverter * pConv ) 50 { 51 pConv->FillItemSet( m_rOutItemSet ); 52 } 53 54 private: 55 SfxItemSet & m_rOutItemSet; 56 }; 57 58 class ApplyItemSetFunc : public ::std::unary_function< ItemConverter *, void > 59 { 60 public: ApplyItemSetFunc(const SfxItemSet & rItemSet,bool & rOutResult)61 explicit ApplyItemSetFunc( const SfxItemSet & rItemSet, 62 bool & rOutResult ) : 63 m_rItemSet( rItemSet ), 64 m_rOutResult( rOutResult ) 65 {} 66 operator ()(ItemConverter * pConv)67 void operator() ( ItemConverter * pConv ) 68 { 69 m_rOutResult = pConv->ApplyItemSet( m_rItemSet ) || m_rOutResult; 70 } 71 72 private: 73 const SfxItemSet & m_rItemSet; 74 bool & m_rOutResult; 75 }; 76 77 struct DeleteItemConverterPtr : public ::std::unary_function< ItemConverter *, void > 78 { operator ()comphelper::DeleteItemConverterPtr79 void operator() ( ItemConverter * pConv ) 80 { delete pConv; } 81 }; 82 83 } // namespace comphelper 84 85 // CHART_ITEMPROPERTYMAP_HXX 86 #endif 87