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 _ACCFRMOBJMAP_HXX 24 #define _ACCFRMOBJMAP_HXX 25 26 #include <accfrmobj.hxx> 27 28 #include <svx/svdtypes.hxx> 29 #include <tools/gen.hxx> 30 31 #include <map> 32 33 class SwAccessibleMap; 34 class SwDoc; 35 class SwRect; 36 class SwFrm; 37 class SdrObject; 38 39 class SwAccessibleChildMapKey 40 { 41 public: 42 enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW }; 43 SwAccessibleChildMapKey()44 inline SwAccessibleChildMapKey() 45 : eLayerId( INVALID ) 46 , nOrdNum( 0 ) 47 , nPosNum( 0, 0 ) 48 {} 49 SwAccessibleChildMapKey(LayerId eId,sal_uInt32 nOrd)50 inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd ) 51 : eLayerId( eId ) 52 , nOrdNum( nOrd ) 53 , nPosNum( 0, 0 ) 54 {} 55 SwAccessibleChildMapKey(LayerId eId,sal_uInt32 nOrd,Point nPos)56 inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos ) 57 : eLayerId( eId ) 58 , nOrdNum( nOrd ) 59 , nPosNum( nPos ) 60 {} 61 operator ()(const SwAccessibleChildMapKey & r1,const SwAccessibleChildMapKey & r2) const62 inline bool operator()( const SwAccessibleChildMapKey& r1, 63 const SwAccessibleChildMapKey& r2 ) const 64 { 65 // return (r1.eLayerId == r2.eLayerId) 66 // ? (r1.nOrdNum < r2.nOrdNum) 67 // : (r1.eLayerId < r2.eLayerId); 68 return (r1.eLayerId == r2.eLayerId) ? 69 ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) : 70 (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() : 71 r1.nPosNum.getY() < r2.nPosNum.getY()) ) : 72 (r1.eLayerId < r2.eLayerId); 73 } 74 75 /* MT: Need to get this position parameter stuff in dev300 somehow... 76 //This methods are used to insert an object to the map, adding a position parameter. 77 ::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos, 78 const SwFrmOrObj& rLower ); 79 ::std::pair< iterator, bool > insert( const SdrObject *pObj, 80 const SwFrmOrObj& rLower, 81 const SwDoc *pDoc, 82 Point nPos); 83 */ 84 85 private: 86 87 LayerId eLayerId; 88 sal_uInt32 nOrdNum; 89 90 Point nPosNum; 91 92 }; 93 94 typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey > 95 _SwAccessibleChildMap; 96 97 class SwAccessibleChildMap : public _SwAccessibleChildMap 98 { 99 const SdrLayerID nHellId; 100 const SdrLayerID nControlsId; 101 102 ::std::pair< iterator, bool > insert( const sal_uInt32 nPos, 103 const SwAccessibleChildMapKey::LayerId eLayerId, 104 const sw::access::SwAccessibleChild& rLower ); 105 ::std::pair< iterator, bool > insert( const SdrObject* pObj, 106 const sw::access::SwAccessibleChild& rLower ); 107 108 public: 109 110 SwAccessibleChildMap( const SwRect& rVisArea, 111 const SwFrm& rFrm, 112 SwAccessibleMap& rAccMap ); 113 114 static sal_Bool IsSortingRequired( const SwFrm& rFrm ); 115 }; 116 117 #endif 118 119