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 
30 #include <map>
31 
32 class SwAccessibleMap;
33 class SwDoc;
34 class SwRect;
35 class SwFrm;
36 class SdrObject;
37 
38 class SwAccessibleChildMapKey
39 {
40 public:
41     enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
42 
43     inline SwAccessibleChildMapKey()
44         : eLayerId( INVALID )
45         , nOrdNum( 0 )
46     {}
47 
48     inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
49         : eLayerId( eId )
50         , nOrdNum( nOrd )
51     {}
52 
53     inline bool operator()( const SwAccessibleChildMapKey& r1,
54                             const SwAccessibleChildMapKey& r2 ) const
55     {
56         return (r1.eLayerId == r2.eLayerId)
57                ? (r1.nOrdNum < r2.nOrdNum)
58                : (r1.eLayerId < r2.eLayerId);
59     }
60 
61 private:
62 
63     LayerId eLayerId;
64     sal_uInt32 nOrdNum;
65 
66 };
67 
68 typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
69     _SwAccessibleChildMap;
70 
71 class SwAccessibleChildMap : public _SwAccessibleChildMap
72 {
73     const SdrLayerID nHellId;
74     const SdrLayerID nControlsId;
75 
76     ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
77                                           const SwAccessibleChildMapKey::LayerId eLayerId,
78                                           const sw::access::SwAccessibleChild& rLower );
79     ::std::pair< iterator, bool > insert( const SdrObject* pObj,
80                                           const sw::access::SwAccessibleChild& rLower );
81 
82 public:
83 
84     SwAccessibleChildMap( const SwRect& rVisArea,
85                           const SwFrm& rFrm,
86                           SwAccessibleMap& rAccMap );
87 
88     static sal_Bool IsSortingRequired( const SwFrm& rFrm );
89 };
90 
91 #endif
92 
93