1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
21 #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
23 #include <tools/gen.hxx>
24 #include <svx/svdtypes.hxx>
25 #include "accfrmobj.hxx"
28 class SwAccessibleMap
;
33 class SwAccessibleChildMapKey
36 enum LayerId
{ INVALID
, HELL
, TEXT
, HEAVEN
, CONTROLS
, XWINDOW
};
38 SwAccessibleChildMapKey()
39 : m_eLayerId( INVALID
)
44 SwAccessibleChildMapKey( LayerId eId
, sal_uInt32 nOrd
)
50 bool operator()( const SwAccessibleChildMapKey
& r1
,
51 const SwAccessibleChildMapKey
& r2
) const
53 if(r1
.m_eLayerId
== r2
.m_eLayerId
)
55 if(r1
.m_nPosNum
== r2
.m_nPosNum
)
56 return r1
.m_nOrdNum
< r2
.m_nOrdNum
;
59 if(r1
.m_nPosNum
.getY() == r2
.m_nPosNum
.getY())
60 return r1
.m_nPosNum
.getX() < r2
.m_nPosNum
.getX();
62 return r1
.m_nPosNum
.getY() < r2
.m_nPosNum
.getY();
66 return r1
.m_eLayerId
< r2
.m_eLayerId
;
69 /* MT: Need to get this position parameter stuff in dev300 somehow...
70 //This methods are used to insert an object to the map, adding a position parameter.
71 std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos,
72 const SwFrameOrObj& rLower );
73 std::pair< iterator, bool > insert( const SdrObject *pObj,
74 const SwFrameOrObj& rLower,
86 class SwAccessibleChildMap
89 typedef SwAccessibleChildMapKey key_type
;
90 typedef sw::access::SwAccessibleChild mapped_type
;
91 typedef std::pair
<const key_type
,mapped_type
> value_type
;
92 typedef SwAccessibleChildMapKey key_compare
;
93 typedef std::map
<key_type
,mapped_type
,key_compare
>::iterator iterator
;
94 typedef std::map
<key_type
,mapped_type
,key_compare
>::const_iterator const_iterator
;
95 typedef std::map
<key_type
,mapped_type
,key_compare
>::const_reverse_iterator const_reverse_iterator
;
98 const SdrLayerID mnHellId
;
99 const SdrLayerID mnControlsId
;
100 std::map
<key_type
,mapped_type
,key_compare
> maMap
;
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
);
109 SwAccessibleChildMap( const SwRect
& rVisArea
,
110 const SwFrame
& rFrame
,
111 SwAccessibleMap
& rAccMap
);
113 static bool IsSortingRequired( const SwFrame
& rFrame
);
115 const_iterator
cbegin() const { return maMap
.cbegin(); }
116 const_iterator
cend() const { return maMap
.cend(); }
117 const_reverse_iterator
crbegin() const { return maMap
.crbegin(); }
118 const_reverse_iterator
crend() const { return maMap
.crend(); }
120 template<class... Args
>
121 std::pair
<iterator
,bool> emplace(Args
&&... args
) { return maMap
.emplace(std::forward
<Args
>(args
)...); }
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */