1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _ACCFRMOBJMAP_HXX
28 #define _ACCFRMOBJMAP_HXX
29 
30 #include <accfrmobj.hxx>
31 
32 #include <svx/svdtypes.hxx>
33 
34 #include <map>
35 
36 class SwAccessibleMap;
37 class SwDoc;
38 class SwRect;
39 class SwFrm;
40 class SdrObject;
41 
42 class SwAccessibleChildMapKey
43 {
44 public:
45     enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
46 
47     inline SwAccessibleChildMapKey()
48         : eLayerId( INVALID )
49         , nOrdNum( 0 )
50     {}
51 
52     inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
53         : eLayerId( eId )
54         , nOrdNum( nOrd )
55     {}
56 
57     inline bool operator()( const SwAccessibleChildMapKey& r1,
58                             const SwAccessibleChildMapKey& r2 ) const
59     {
60         return (r1.eLayerId == r2.eLayerId)
61                ? (r1.nOrdNum < r2.nOrdNum)
62                : (r1.eLayerId < r2.eLayerId);
63     }
64 
65 private:
66 
67     LayerId eLayerId;
68     sal_uInt32 nOrdNum;
69 
70 };
71 
72 typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
73     _SwAccessibleChildMap;
74 
75 class SwAccessibleChildMap : public _SwAccessibleChildMap
76 {
77     const SdrLayerID nHellId;
78     const SdrLayerID nControlsId;
79 
80     ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
81                                           const SwAccessibleChildMapKey::LayerId eLayerId,
82                                           const sw::access::SwAccessibleChild& rLower );
83     ::std::pair< iterator, bool > insert( const SdrObject* pObj,
84                                           const sw::access::SwAccessibleChild& rLower );
85 
86 public:
87 
88     SwAccessibleChildMap( const SwRect& rVisArea,
89                           const SwFrm& rFrm,
90                           SwAccessibleMap& rAccMap );
91 
92     static sal_Bool IsSortingRequired( const SwFrm& rFrm );
93 };
94 
95 #endif
96 
97