LCOV - code coverage report
Current view: top level - sw/source/core/access - accfrmobjmap.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 13 20 65.0 %
Date: 2015-06-13 12:38:46 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          Line data    Source code
       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 SwFrm;
      31             : class SdrObject;
      32             : 
      33             : class SwAccessibleChildMapKey
      34             : {
      35             : public:
      36             :     enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
      37             : 
      38           2 :     SwAccessibleChildMapKey()
      39             :         : eLayerId( INVALID )
      40             :         , nOrdNum( 0 )
      41           2 :         , nPosNum( 0, 0 )
      42           2 :     {}
      43             : 
      44           4 :     SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
      45             :         : eLayerId( eId )
      46             :         , nOrdNum( nOrd )
      47           4 :         , nPosNum( 0, 0 )
      48           4 :     {}
      49             : 
      50             :     SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos )
      51             :         : eLayerId( eId )
      52             :         , nOrdNum( nOrd )
      53             :         , nPosNum( nPos )
      54             :     {}
      55             : 
      56           6 :     bool operator()( const SwAccessibleChildMapKey& r1,
      57             :                             const SwAccessibleChildMapKey& r2 ) const
      58             :     {
      59           6 :         if(r1.eLayerId == r2.eLayerId)
      60             :         {
      61           0 :             if(r1.nPosNum == r2.nPosNum)
      62           0 :                 return r1.nOrdNum < r2.nOrdNum;
      63             :             else
      64             :             {
      65           0 :                 if(r1.nPosNum.getY() == r2.nPosNum.getY())
      66           0 :                     return r1.nPosNum.getX() < r2.nPosNum.getX();
      67             :                 else
      68           0 :                     return r1.nPosNum.getY() < r2.nPosNum.getY();
      69             :             }
      70             :         }
      71             :         else
      72           6 :             return r1.eLayerId < r2.eLayerId;
      73             :     }
      74             : 
      75             :     /* MT: Need to get this position parameter stuff in dev300 somehow...
      76             :     //This methods are used to insert an object to the map, adding a position parameter.
      77             :     ::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos,
      78             :                                           const SwFrmOrObj& rLower );
      79             :     ::std::pair< iterator, bool > insert( const SdrObject *pObj,
      80             :                                           const SwFrmOrObj& rLower,
      81             :                                           const SwDoc *pDoc,
      82             :                                           Point nPos);
      83             :     */
      84             : 
      85             : private:
      86             :     LayerId eLayerId;
      87             :     sal_uInt32 nOrdNum;
      88             :     Point nPosNum;
      89             : };
      90             : 
      91             : 
      92           2 : class SwAccessibleChildMap
      93             : {
      94             : public:
      95             :     typedef SwAccessibleChildMapKey                                             key_type;
      96             :     typedef sw::access::SwAccessibleChild                                       mapped_type;
      97             :     typedef std::pair<const key_type,mapped_type>                               value_type;
      98             :     typedef SwAccessibleChildMapKey                                             key_compare;
      99             :     typedef std::map<key_type,mapped_type,key_compare>::iterator                iterator;
     100             :     typedef std::map<key_type,mapped_type,key_compare>::const_iterator          const_iterator;
     101             :     typedef std::map<key_type,mapped_type,key_compare>::const_reverse_iterator  const_reverse_iterator;
     102             : 
     103             : private:
     104             :     const SdrLayerID nHellId;
     105             :     const SdrLayerID nControlsId;
     106             :     std::map<key_type,mapped_type,key_compare> maMap;
     107             : 
     108             :     ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
     109             :                                           const SwAccessibleChildMapKey::LayerId eLayerId,
     110             :                                           const sw::access::SwAccessibleChild& rLower );
     111             :     ::std::pair< iterator, bool > insert( const SdrObject* pObj,
     112             :                                           const sw::access::SwAccessibleChild& rLower );
     113             : 
     114             : public:
     115             :     SwAccessibleChildMap( const SwRect& rVisArea,
     116             :                           const SwFrm& rFrm,
     117             :                           SwAccessibleMap& rAccMap );
     118             : 
     119             :     static bool IsSortingRequired( const SwFrm& rFrm );
     120             : 
     121             :     iterator begin() { return maMap.begin(); }
     122           2 :     const_iterator cbegin() const { return maMap.cbegin(); }
     123             :     iterator end() { return maMap.end(); }
     124           5 :     const_iterator cend() const { return maMap.cend(); }
     125           0 :     const_reverse_iterator crbegin() const { return maMap.crbegin(); }
     126           0 :     const_reverse_iterator crend() const { return maMap.crend(); }
     127             : 
     128           4 :     std::pair<iterator,bool> insert(const value_type& value) { return maMap.insert(value); }
     129             : };
     130             : 
     131             : #endif
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11