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

Generated by: LCOV version 1.10