LibreOffice Module sw (master)  1
accfrmobjmap.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
21 #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJMAP_HXX
22 
23 #include <tools/gen.hxx>
24 #include <svx/svdtypes.hxx>
25 #include "accfrmobj.hxx"
26 #include <map>
27 
28 class SwAccessibleMap;
29 class SwRect;
30 class SwFrame;
31 class SdrObject;
32 
34 {
35 public:
37 
39  : m_eLayerId( INVALID )
40  , m_nOrdNum( 0 )
41  , m_nPosNum( 0, 0 )
42  {}
43 
44  SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
45  : m_eLayerId( eId )
46  , m_nOrdNum( nOrd )
47  , m_nPosNum( 0, 0 )
48  {}
49 
51  const SwAccessibleChildMapKey& r2 ) const
52  {
53  if(r1.m_eLayerId == r2.m_eLayerId)
54  {
55  if(r1.m_nPosNum == r2.m_nPosNum)
56  return r1.m_nOrdNum < r2.m_nOrdNum;
57  else
58  {
59  if(r1.m_nPosNum.getY() == r2.m_nPosNum.getY())
60  return r1.m_nPosNum.getX() < r2.m_nPosNum.getX();
61  else
62  return r1.m_nPosNum.getY() < r2.m_nPosNum.getY();
63  }
64  }
65  else
66  return r1.m_eLayerId < r2.m_eLayerId;
67  }
68 
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,
75  const SwDoc *pDoc,
76  Point nPos);
77  */
78 
79 private:
81  sal_uInt32 const m_nOrdNum;
83 };
84 
85 
87 {
88 public:
91  typedef std::pair<const key_type,mapped_type> value_type;
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;
96 
97 private:
100  std::map<key_type,mapped_type,key_compare> maMap;
101 
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 );
107 
108 public:
109  SwAccessibleChildMap( const SwRect& rVisArea,
110  const SwFrame& rFrame,
111  SwAccessibleMap& rAccMap );
112 
113  static bool IsSortingRequired( const SwFrame& rFrame );
114 
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(); }
119 
120  template<class... Args>
121  std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); }
122 };
123 
124 #endif
125 
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
const_reverse_iterator crbegin() const
const_iterator cbegin() const
const_reverse_iterator crend() const
sal_uInt32 const m_nOrdNum
tuple args
const SdrLayerID mnControlsId
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
std::map< key_type, mapped_type, key_compare >::const_iterator const_iterator
sw::access::SwAccessibleChild mapped_type
LayerId const m_eLayerId
std::map< key_type, mapped_type, key_compare >::const_reverse_iterator const_reverse_iterator
std::map< key_type, mapped_type, key_compare > maMap
std::pair< iterator, bool > emplace(Args &&...args)
long getY() const
std::pair< iterator, bool > insert(const sal_uInt32 nPos, const SwAccessibleChildMapKey::LayerId eLayerId, const sw::access::SwAccessibleChild &rLower)
long getX() const
SwAccessibleChildMap(const SwRect &rVisArea, const SwFrame &rFrame, SwAccessibleMap &rAccMap)
std::map< key_type, mapped_type, key_compare >::iterator iterator
std::pair< const key_type, mapped_type > value_type
SwAccessibleChildMapKey key_compare
const_iterator cend() const
static bool IsSortingRequired(const SwFrame &rFrame)
SwAccessibleChildMapKey key_type
bool operator()(const SwAccessibleChildMapKey &r1, const SwAccessibleChildMapKey &r2) const
SwAccessibleChildMapKey(LayerId eId, sal_uInt32 nOrd)
const SdrLayerID mnHellId