LCOV - code coverage report
Current view: top level - comphelper/source/misc - accessiblecomponenthelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 50 67 74.6 %
Date: 2012-08-25 Functions: 21 33 63.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 36 72 50.0 %

           Branch data     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 <comphelper/accessiblecomponenthelper.hxx>
      21                 :            : 
      22                 :            : //.........................................................................
      23                 :            : namespace comphelper
      24                 :            : {
      25                 :            : //.........................................................................
      26                 :            : 
      27                 :            :     using namespace ::com::sun::star::uno;
      28                 :            :     using namespace ::com::sun::star::awt;
      29                 :            :     using namespace ::com::sun::star::lang;
      30                 :            :     using namespace ::com::sun::star::accessibility;
      31                 :            : 
      32                 :            :     //=====================================================================
      33                 :            :     //= OCommonAccessibleComponent
      34                 :            :     //=====================================================================
      35                 :            :     //---------------------------------------------------------------------
      36                 :         60 :     OCommonAccessibleComponent::OCommonAccessibleComponent( )
      37                 :            :     {
      38                 :         60 :     }
      39                 :            : 
      40                 :            :     //---------------------------------------------------------------------
      41                 :       5304 :     OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
      42                 :       5304 :         :OAccessibleContextHelper( _pExternalLock )
      43                 :            :     {
      44                 :       5304 :     }
      45                 :            : 
      46                 :            :     //---------------------------------------------------------------------
      47                 :       5308 :     OCommonAccessibleComponent::~OCommonAccessibleComponent( )
      48                 :            :     {
      49         [ +  - ]:       5308 :         forgetExternalLock();
      50                 :            :             // this ensures that the lock, which may be already destroyed as part of the derivee,
      51                 :            :             // is not used anymore
      52         [ -  + ]:       5308 :     }
      53                 :            : 
      54                 :            :     //--------------------------------------------------------------------
      55                 :      12980 :     sal_Bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
      56                 :            :     {
      57         [ +  - ]:      12980 :         OExternalLockGuard aGuard( this );
      58         [ +  - ]:      12980 :         Rectangle aBounds( implGetBounds() );
      59                 :            :         return  ( _rPoint.X >= 0 )
      60                 :            :             &&  ( _rPoint.Y >= 0 )
      61                 :            :             &&  ( _rPoint.X < aBounds.Width )
      62 [ +  + ][ +  + ]:      12980 :             &&  ( _rPoint.Y < aBounds.Height );
         [ +  + ][ +  + ]
                 [ +  - ]
      63                 :            :     }
      64                 :            : 
      65                 :            :     //--------------------------------------------------------------------
      66                 :       1362 :     Point SAL_CALL OCommonAccessibleComponent::getLocation(  ) throw (RuntimeException)
      67                 :            :     {
      68         [ +  - ]:       1362 :         OExternalLockGuard aGuard( this );
      69         [ +  - ]:       1362 :         Rectangle aBounds( implGetBounds() );
      70         [ +  - ]:       1362 :         return Point( aBounds.X, aBounds.Y );
      71                 :            :     }
      72                 :            : 
      73                 :            :     //--------------------------------------------------------------------
      74                 :       1350 :     Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen(  ) throw (RuntimeException)
      75                 :            :     {
      76         [ +  - ]:       1350 :         OExternalLockGuard aGuard( this );
      77                 :            : 
      78                 :       1350 :         Point aScreenLoc( 0, 0 );
      79                 :            : 
      80 [ +  - ][ +  - ]:       1350 :         Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
      81                 :            :         OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
      82         [ +  - ]:       1350 :         if ( xParentComponent.is() )
      83                 :            :         {
      84 [ +  - ][ +  - ]:       1350 :             Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
      85         [ +  - ]:       1350 :             Point aOwnRelativeLoc( getLocation() );
      86                 :       1350 :             aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
      87                 :       1350 :             aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
      88                 :            :         }
      89                 :            : 
      90         [ +  - ]:       1350 :         return aScreenLoc;
      91                 :            :     }
      92                 :            : 
      93                 :            :     //--------------------------------------------------------------------
      94                 :         12 :     Size SAL_CALL OCommonAccessibleComponent::getSize(  ) throw (RuntimeException)
      95                 :            :     {
      96         [ +  - ]:         12 :         OExternalLockGuard aGuard( this );
      97         [ +  - ]:         12 :         Rectangle aBounds( implGetBounds() );
      98         [ +  - ]:         12 :         return Size( aBounds.Width, aBounds.Height );
      99                 :            :     }
     100                 :            : 
     101                 :            :     //--------------------------------------------------------------------
     102                 :       1583 :     Rectangle SAL_CALL OCommonAccessibleComponent::getBounds(  ) throw (RuntimeException)
     103                 :            :     {
     104         [ +  - ]:       1583 :         OExternalLockGuard aGuard( this );
     105 [ +  - ][ +  - ]:       1583 :         return implGetBounds();
     106                 :            :     }
     107                 :            : 
     108                 :            :     //=====================================================================
     109                 :            :     //= OAccessibleComponentHelper
     110                 :            :     //=====================================================================
     111                 :            :     //---------------------------------------------------------------------
     112                 :         60 :     OAccessibleComponentHelper::OAccessibleComponentHelper( )
     113                 :            :     {
     114                 :         60 :     }
     115                 :            : 
     116                 :            :     //---------------------------------------------------------------------
     117                 :          0 :     OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
     118                 :          0 :         :OCommonAccessibleComponent( _pExternalLock )
     119                 :            :     {
     120                 :          0 :     }
     121                 :            : 
     122                 :            :     //--------------------------------------------------------------------
     123 [ +  + ][ +  - ]:       2871 :     IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
     124 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
                 [ #  # ]
     125                 :            :         // (order matters: the first is the class name, the second is the class doing the ref counting)
     126                 :            : 
     127                 :            :     //--------------------------------------------------------------------
     128                 :          0 :     sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
     129                 :            :     {
     130                 :          0 :         return OCommonAccessibleComponent::containsPoint( _rPoint );
     131                 :            :     }
     132                 :            : 
     133                 :            :     //--------------------------------------------------------------------
     134                 :          0 :     Point SAL_CALL OAccessibleComponentHelper::getLocation(  ) throw (RuntimeException)
     135                 :            :     {
     136                 :          0 :         return OCommonAccessibleComponent::getLocation( );
     137                 :            :     }
     138                 :            : 
     139                 :            :     //--------------------------------------------------------------------
     140                 :          0 :     Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen(  ) throw (RuntimeException)
     141                 :            :     {
     142                 :          0 :         return OCommonAccessibleComponent::getLocationOnScreen( );
     143                 :            :     }
     144                 :            : 
     145                 :            :     //--------------------------------------------------------------------
     146                 :          0 :     Size SAL_CALL OAccessibleComponentHelper::getSize(  ) throw (RuntimeException)
     147                 :            :     {
     148                 :          0 :         return OCommonAccessibleComponent::getSize( );
     149                 :            :     }
     150                 :            : 
     151                 :            :     //--------------------------------------------------------------------
     152                 :          0 :     Rectangle SAL_CALL OAccessibleComponentHelper::getBounds(  ) throw (RuntimeException)
     153                 :            :     {
     154                 :          0 :         return OCommonAccessibleComponent::getBounds( );
     155                 :            :     }
     156                 :            : 
     157                 :            :     //=====================================================================
     158                 :            :     //= OAccessibleExtendedComponentHelper
     159                 :            :     //=====================================================================
     160                 :            :     //---------------------------------------------------------------------
     161                 :          0 :     OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( )
     162                 :            :     {
     163                 :          0 :     }
     164                 :            : 
     165                 :            :     //---------------------------------------------------------------------
     166                 :       5304 :     OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
     167                 :       5304 :         :OCommonAccessibleComponent( _pExternalLock )
     168                 :            :     {
     169                 :       5304 :     }
     170                 :            : 
     171                 :            :     //--------------------------------------------------------------------
     172 [ +  + ][ +  - ]:     322628 :     IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
     173 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
                 [ #  # ]
     174                 :            :         // (order matters: the first is the class name, the second is the class doing the ref counting)
     175                 :            : 
     176                 :            :     //--------------------------------------------------------------------
     177                 :      12980 :     sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
     178                 :            :     {
     179                 :      12980 :         return OCommonAccessibleComponent::containsPoint( _rPoint );
     180                 :            :     }
     181                 :            : 
     182                 :            :     //--------------------------------------------------------------------
     183                 :         12 :     Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation(  ) throw (RuntimeException)
     184                 :            :     {
     185                 :         12 :         return OCommonAccessibleComponent::getLocation( );
     186                 :            :     }
     187                 :            : 
     188                 :            :     //--------------------------------------------------------------------
     189                 :       1350 :     Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen(  ) throw (RuntimeException)
     190                 :            :     {
     191                 :       1350 :         return OCommonAccessibleComponent::getLocationOnScreen( );
     192                 :            :     }
     193                 :            : 
     194                 :            :     //--------------------------------------------------------------------
     195                 :         12 :     Size SAL_CALL OAccessibleExtendedComponentHelper::getSize(  ) throw (RuntimeException)
     196                 :            :     {
     197                 :         12 :         return OCommonAccessibleComponent::getSize( );
     198                 :            :     }
     199                 :            : 
     200                 :            :     //--------------------------------------------------------------------
     201                 :       1583 :     Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds(  ) throw (RuntimeException)
     202                 :            :     {
     203                 :       1583 :         return OCommonAccessibleComponent::getBounds( );
     204                 :            :     }
     205                 :            : 
     206                 :            : //.........................................................................
     207                 :            : }   // namespace comphelper
     208                 :            : //.........................................................................
     209                 :            : 
     210                 :            : 
     211                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10