LCOV - code coverage report
Current view: top level - sw/source/core/access - accfrmobjmap.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 62 0.0 %
Date: 2014-04-14 Functions: 0 4 0.0 %
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             : #include <accfrmobjmap.hxx>
      21             : #include <accframe.hxx>
      22             : #include <accmap.hxx>
      23             : #include <acccontext.hxx>
      24             : 
      25             : #include <viewsh.hxx>
      26             : #include <doc.hxx>
      27             : #include <frmfmt.hxx>
      28             : #include <pagefrm.hxx>
      29             : #include <txtfrm.hxx>
      30             : #include <node.hxx>
      31             : #include <sortedobjs.hxx>
      32             : #include <anchoredobject.hxx>
      33             : 
      34             : #include <svx/svdobj.hxx>
      35             : 
      36             : using namespace sw::access;
      37             : 
      38           0 : SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
      39             :                                             const SwFrm& rFrm,
      40             :                                             SwAccessibleMap& rAccMap )
      41           0 :     : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() )
      42           0 :     , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() )
      43             : {
      44           0 :     const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly();
      45             : 
      46           0 :     sal_uInt32 nPos = 0;
      47           0 :     SwAccessibleChild aLower( rFrm.GetLower() );
      48           0 :     while( aLower.GetSwFrm() )
      49             :     {
      50           0 :         if ( !bVisibleChildrenOnly ||
      51           0 :              aLower.AlwaysIncludeAsChild() ||
      52           0 :              aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
      53             :         {
      54           0 :             insert( nPos++, SwAccessibleChildMapKey::TEXT, aLower );
      55             :         }
      56             : 
      57           0 :         aLower = aLower.GetSwFrm()->GetNext();
      58             :     }
      59             : 
      60           0 :     if ( rFrm.IsPageFrm() )
      61             :     {
      62             :         OSL_ENSURE( bVisibleChildrenOnly, "page frame within tab frame???" );
      63             :         const SwPageFrm *pPgFrm =
      64           0 :             static_cast< const SwPageFrm * >( &rFrm );
      65           0 :         const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
      66           0 :         if ( pObjs )
      67             :         {
      68           0 :             for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
      69             :             {
      70           0 :                 aLower = (*pObjs)[i]->GetDrawObj();
      71           0 :                 if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
      72             :                 {
      73           0 :                     insert( aLower.GetDrawObject(), aLower );
      74             :                 }
      75             :             }
      76             :         }
      77             :     }
      78           0 :     else if( rFrm.IsTxtFrm() )
      79             :     {
      80           0 :         const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
      81           0 :         if ( pObjs )
      82             :         {
      83           0 :             for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
      84             :             {
      85           0 :                 aLower = (*pObjs)[i]->GetDrawObj();
      86           0 :                 if ( aLower.IsBoundAsChar() &&
      87           0 :                      ( !bVisibleChildrenOnly ||
      88           0 :                        aLower.AlwaysIncludeAsChild() ||
      89           0 :                        aLower.GetBox( rAccMap ).IsOver( rVisArea ) ) )
      90             :                 {
      91           0 :                     insert( aLower.GetDrawObject(), aLower );
      92             :                 }
      93             :             }
      94             :         }
      95             : 
      96             :         {
      97             :             ::rtl::Reference < SwAccessibleContext > xAccImpl =
      98           0 :                                 rAccMap.GetContextImpl( &rFrm, sal_False );
      99           0 :             if( xAccImpl.is() )
     100             :             {
     101           0 :                 SwAccessibleContext* pAccImpl = xAccImpl.get();
     102           0 :                 if ( pAccImpl &&
     103           0 :                      pAccImpl->HasAdditionalAccessibleChildren() )
     104             :                 {
     105             :                     std::vector< Window* >* pAdditionalChildren =
     106           0 :                                                 new std::vector< Window* >();
     107           0 :                     pAccImpl->GetAdditionalAccessibleChildren( pAdditionalChildren );
     108             : 
     109           0 :                     sal_Int32 nCounter( 0 );
     110           0 :                     for ( std::vector< Window* >::iterator aIter = pAdditionalChildren->begin();
     111           0 :                           aIter != pAdditionalChildren->end();
     112             :                           ++aIter )
     113             :                     {
     114           0 :                         aLower = (*aIter);
     115           0 :                         insert( ++nCounter, SwAccessibleChildMapKey::XWINDOW, aLower );
     116             :                     }
     117             : 
     118           0 :                     delete pAdditionalChildren;
     119             :                 }
     120           0 :             }
     121             :         }
     122             :     }
     123           0 : }
     124             : 
     125           0 : ::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
     126             :                                                 const sal_uInt32 nPos,
     127             :                                                 const SwAccessibleChildMapKey::LayerId eLayerId,
     128             :                                                 const SwAccessibleChild& rLower )
     129             : {
     130           0 :     SwAccessibleChildMapKey aKey( eLayerId, nPos );
     131           0 :     value_type aEntry( aKey, rLower );
     132           0 :     return _SwAccessibleChildMap::insert( aEntry );
     133             : }
     134             : 
     135           0 : ::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
     136             :                                                 const SdrObject *pObj,
     137             :                                                 const SwAccessibleChild& rLower )
     138             : {
     139           0 :     const SdrLayerID nLayer = pObj->GetLayer();
     140             :     SwAccessibleChildMapKey::LayerId eLayerId =
     141           0 :                     (nHellId == nLayer)
     142             :                     ? SwAccessibleChildMapKey::HELL
     143           0 :                     : ( (nControlsId == nLayer)
     144             :                         ? SwAccessibleChildMapKey::CONTROLS
     145           0 :                         : SwAccessibleChildMapKey::HEAVEN );
     146           0 :     SwAccessibleChildMapKey aKey( eLayerId, pObj->GetOrdNum() );
     147           0 :     value_type aEntry( aKey, rLower );
     148           0 :     return _SwAccessibleChildMap::insert( aEntry );
     149             : }
     150             : 
     151           0 : bool SwAccessibleChildMap::IsSortingRequired( const SwFrm& rFrm )
     152             : {
     153           0 :     return ( rFrm.IsPageFrm() &&
     154           0 :              static_cast< const SwPageFrm& >( rFrm ).GetSortedObjs() ) ||
     155           0 :            ( rFrm.IsTxtFrm() &&
     156           0 :              rFrm.GetDrawObjs() );
     157             : }
     158             : 
     159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10