11d2dbeb0SAndrew Rist /**************************************************************
21d2dbeb0SAndrew Rist  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _ACCFRMOBJMAP_HXX
24cdf0e10cSrcweir #define _ACCFRMOBJMAP_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <accfrmobj.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svx/svdtypes.hxx>
29*ca62e2c2SSteve Yin #include <tools/gen.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <map>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SwAccessibleMap;
34cdf0e10cSrcweir class SwDoc;
35cdf0e10cSrcweir class SwRect;
36cdf0e10cSrcweir class SwFrm;
37cdf0e10cSrcweir class SdrObject;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SwAccessibleChildMapKey
40cdf0e10cSrcweir {
41cdf0e10cSrcweir public:
42cdf0e10cSrcweir     enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
43cdf0e10cSrcweir 
SwAccessibleChildMapKey()44cdf0e10cSrcweir     inline SwAccessibleChildMapKey()
45cdf0e10cSrcweir         : eLayerId( INVALID )
46cdf0e10cSrcweir         , nOrdNum( 0 )
47*ca62e2c2SSteve Yin         , nPosNum( 0, 0 )
48cdf0e10cSrcweir     {}
49cdf0e10cSrcweir 
SwAccessibleChildMapKey(LayerId eId,sal_uInt32 nOrd)50cdf0e10cSrcweir     inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
51cdf0e10cSrcweir         : eLayerId( eId )
52cdf0e10cSrcweir         , nOrdNum( nOrd )
53*ca62e2c2SSteve Yin         , nPosNum( 0, 0 )
54cdf0e10cSrcweir     {}
55cdf0e10cSrcweir 
SwAccessibleChildMapKey(LayerId eId,sal_uInt32 nOrd,Point nPos)56*ca62e2c2SSteve Yin     inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos )
57*ca62e2c2SSteve Yin         : eLayerId( eId )
58*ca62e2c2SSteve Yin         , nOrdNum( nOrd )
59*ca62e2c2SSteve Yin         , nPosNum( nPos )
60*ca62e2c2SSteve Yin     {}
61*ca62e2c2SSteve Yin 
operator ()(const SwAccessibleChildMapKey & r1,const SwAccessibleChildMapKey & r2) const62cdf0e10cSrcweir     inline bool operator()( const SwAccessibleChildMapKey& r1,
63cdf0e10cSrcweir                             const SwAccessibleChildMapKey& r2 ) const
64cdf0e10cSrcweir     {
65*ca62e2c2SSteve Yin //        return (r1.eLayerId == r2.eLayerId)
66*ca62e2c2SSteve Yin //               ? (r1.nOrdNum < r2.nOrdNum)
67*ca62e2c2SSteve Yin //               : (r1.eLayerId < r2.eLayerId);
68*ca62e2c2SSteve Yin 	return (r1.eLayerId == r2.eLayerId) ?
69*ca62e2c2SSteve Yin 		   ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) :
70*ca62e2c2SSteve Yin 		   (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() :
71*ca62e2c2SSteve Yin 		   	r1.nPosNum.getY() < r2.nPosNum.getY()) ) :
72*ca62e2c2SSteve Yin 		   (r1.eLayerId < r2.eLayerId);
73cdf0e10cSrcweir     }
74*ca62e2c2SSteve Yin 
75*ca62e2c2SSteve Yin     /* MT: Need to get this position parameter stuff in dev300 somehow...
76*ca62e2c2SSteve Yin 	//This methods are used to insert an object to the map, adding a position parameter.
77*ca62e2c2SSteve Yin 	::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos,
78*ca62e2c2SSteve Yin 										  const SwFrmOrObj& rLower );
79*ca62e2c2SSteve Yin 	::std::pair< iterator, bool > insert( const SdrObject *pObj,
80*ca62e2c2SSteve Yin 								   	 	  const SwFrmOrObj& rLower,
81*ca62e2c2SSteve Yin 									   	  const SwDoc *pDoc,
82*ca62e2c2SSteve Yin 									   	  Point nPos);
83*ca62e2c2SSteve Yin 	*/
84cdf0e10cSrcweir 
85cdf0e10cSrcweir private:
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     LayerId eLayerId;
88cdf0e10cSrcweir     sal_uInt32 nOrdNum;
89*ca62e2c2SSteve Yin 
90*ca62e2c2SSteve Yin 	Point nPosNum;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir };
93cdf0e10cSrcweir 
94cdf0e10cSrcweir typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
95cdf0e10cSrcweir     _SwAccessibleChildMap;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir class SwAccessibleChildMap : public _SwAccessibleChildMap
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     const SdrLayerID nHellId;
100cdf0e10cSrcweir     const SdrLayerID nControlsId;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
103cdf0e10cSrcweir                                           const SwAccessibleChildMapKey::LayerId eLayerId,
104cdf0e10cSrcweir                                           const sw::access::SwAccessibleChild& rLower );
105cdf0e10cSrcweir     ::std::pair< iterator, bool > insert( const SdrObject* pObj,
106cdf0e10cSrcweir                                           const sw::access::SwAccessibleChild& rLower );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir public:
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     SwAccessibleChildMap( const SwRect& rVisArea,
111cdf0e10cSrcweir                           const SwFrm& rFrm,
112cdf0e10cSrcweir                           SwAccessibleMap& rAccMap );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     static sal_Bool IsSortingRequired( const SwFrm& rFrm );
115cdf0e10cSrcweir };
116cdf0e10cSrcweir 
117cdf0e10cSrcweir #endif
118cdf0e10cSrcweir 
119