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 43 { 44 public: 45 typedef ItemConverter * argument_type; 46 typedef void result_type; FillItemSetFunc(SfxItemSet & rOutItemSet)47 explicit FillItemSetFunc( SfxItemSet & rOutItemSet ) : 48 m_rOutItemSet( rOutItemSet ) 49 {} 50 operator ()(ItemConverter * pConv)51 void operator() ( ItemConverter * pConv ) 52 { 53 pConv->FillItemSet( m_rOutItemSet ); 54 } 55 56 private: 57 SfxItemSet & m_rOutItemSet; 58 }; 59 60 class ApplyItemSetFunc 61 { 62 public: 63 typedef ItemConverter * argument_type; 64 typedef void result_type; ApplyItemSetFunc(const SfxItemSet & rItemSet,bool & rOutResult)65 explicit ApplyItemSetFunc( const SfxItemSet & rItemSet, 66 bool & rOutResult ) : 67 m_rItemSet( rItemSet ), 68 m_rOutResult( rOutResult ) 69 {} 70 operator ()(ItemConverter * pConv)71 void operator() ( ItemConverter * pConv ) 72 { 73 m_rOutResult = pConv->ApplyItemSet( m_rItemSet ) || m_rOutResult; 74 } 75 76 private: 77 const SfxItemSet & m_rItemSet; 78 bool & m_rOutResult; 79 }; 80 81 struct DeleteItemConverterPtr 82 { 83 typedef ItemConverter * argument_type; 84 typedef void result_type; operator ()comphelper::DeleteItemConverterPtr85 void operator() ( ItemConverter * pConv ) 86 { delete pConv; } 87 }; 88 89 } // namespace comphelper 90 91 // CHART_ITEMPROPERTYMAP_HXX 92 #endif 93