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 44 inline SwAccessibleChildMapKey() 45 : eLayerId( INVALID ) 46 , nOrdNum( 0 ) 47 , nPosNum( 0, 0 ) 48 {} 49 50 inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd ) 51 : eLayerId( eId ) 52 , nOrdNum( nOrd ) 53 , nPosNum( 0, 0 ) 54 {} 55 56 //IAccessibility2 Implementation 2009----- 57 inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos ) 58 : eLayerId( eId ) 59 , nOrdNum( nOrd ) 60 , nPosNum( nPos ) 61 {} 62 //-----IAccessibility2 Implementation 2009 63 64 inline bool operator()( const SwAccessibleChildMapKey& r1, 65 const SwAccessibleChildMapKey& r2 ) const 66 { 67 //IAccessibility2 Implementation 2009----- 68 // return (r1.eLayerId == r2.eLayerId) 69 // ? (r1.nOrdNum < r2.nOrdNum) 70 // : (r1.eLayerId < r2.eLayerId); 71 return (r1.eLayerId == r2.eLayerId) ? 72 ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) : 73 (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() : 74 r1.nPosNum.getY() < r2.nPosNum.getY()) ) : 75 (r1.eLayerId < r2.eLayerId); 76 //-----IAccessibility2 Implementation 2009 77 } 78 79 /* MT: Need to get this position parameter stuff in dev300 somehow... 80 //IAccessibility2 Implementation 2009----- 81 //This methods are used to insert an object to the map, adding a position parameter. 82 ::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos, 83 const SwFrmOrObj& rLower ); 84 ::std::pair< iterator, bool > insert( const SdrObject *pObj, 85 const SwFrmOrObj& rLower, 86 const SwDoc *pDoc, 87 Point nPos); 88 //-----IAccessibility2 Implementation 2009 89 */ 90 91 private: 92 93 LayerId eLayerId; 94 sal_uInt32 nOrdNum; 95 96 //IAccessibility2 Implementation 2009----- 97 Point nPosNum; 98 //-----IAccessibility2 Implementation 2009 99 100 }; 101 102 typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey > 103 _SwAccessibleChildMap; 104 105 class SwAccessibleChildMap : public _SwAccessibleChildMap 106 { 107 const SdrLayerID nHellId; 108 const SdrLayerID nControlsId; 109 110 ::std::pair< iterator, bool > insert( const sal_uInt32 nPos, 111 const SwAccessibleChildMapKey::LayerId eLayerId, 112 const sw::access::SwAccessibleChild& rLower ); 113 ::std::pair< iterator, bool > insert( const SdrObject* pObj, 114 const sw::access::SwAccessibleChild& rLower ); 115 116 public: 117 118 SwAccessibleChildMap( const SwRect& rVisArea, 119 const SwFrm& rFrm, 120 SwAccessibleMap& rAccMap ); 121 122 static sal_Bool IsSortingRequired( const SwFrm& rFrm ); 123 }; 124 125 #endif 126 127