LCOV - code coverage report
Current view: top level - sw/source/core/access - acchyperlink.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 72 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            :  /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <comphelper/accessiblekeybindinghelper.hxx>
      30                 :            : #include <swurl.hxx>
      31                 :            : #include <osl/mutex.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : #include <ndtxt.hxx>
      34                 :            : #include <txtinet.hxx>
      35                 :            : #include <accpara.hxx>
      36                 :            : #include <acchyperlink.hxx>
      37                 :            : 
      38                 :            : using namespace ::com::sun::star;
      39                 :            : using namespace ::com::sun::star::accessibility;
      40                 :            : using ::rtl::OUString;
      41                 :            : 
      42                 :          0 : SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos,
      43                 :            :     SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) :
      44                 :            :     nHintPos( nHPos ),
      45                 :            :     xPara( p ),
      46                 :            :     nStartIdx( nStt ),
      47                 :          0 :     nEndIdx( nEnd )
      48                 :            : {
      49                 :          0 : }
      50                 :            : 
      51                 :          0 : const SwTxtAttr *SwAccessibleHyperlink::GetTxtAttr() const
      52                 :            : {
      53                 :          0 :     const SwTxtAttr *pTxtAttr = 0;
      54 [ #  # ][ #  # ]:          0 :     if( xPara.is() && xPara->GetMap() )
                 [ #  # ]
      55                 :            :     {
      56                 :          0 :         const SwTxtNode *pTxtNd = xPara->GetTxtNode();
      57                 :          0 :         const SwpHints *pHints = pTxtNd->GetpSwpHints();
      58 [ #  # ][ #  # ]:          0 :         if( pHints && nHintPos < pHints->Count() )
                 [ #  # ]
      59                 :            :         {
      60                 :          0 :             const SwTxtAttr *pHt = (*pHints)[nHintPos];
      61         [ #  # ]:          0 :             if( RES_TXTATR_INETFMT == pHt->Which() )
      62                 :          0 :                 pTxtAttr = pHt;
      63                 :            :         }
      64                 :            :     }
      65                 :            : 
      66                 :          0 :     return pTxtAttr;
      67                 :            : }
      68                 :            : 
      69                 :            : 
      70                 :            : // XAccessibleAction
      71                 :          0 : sal_Int32 SAL_CALL SwAccessibleHyperlink::getAccessibleActionCount()
      72                 :            :         throw (uno::RuntimeException)
      73                 :            : {
      74         [ #  # ]:          0 :      return isValid() ? 1 : 0;
      75                 :            : }
      76                 :            : 
      77                 :          0 : sal_Bool SAL_CALL SwAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex )
      78                 :            :         throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
      79                 :            : {
      80         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      81                 :            : 
      82                 :          0 :     sal_Bool bRet = sal_False;
      83                 :            : 
      84         [ #  # ]:          0 :     const SwTxtAttr *pTxtAttr = GetTxtAttr();
      85 [ #  # ][ #  # ]:          0 :     if( pTxtAttr && 0 == nIndex )
      86                 :            :     {
      87                 :          0 :         const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
      88         [ #  # ]:          0 :         if( rINetFmt.GetValue().Len() )
      89                 :            :         {
      90                 :          0 :             ViewShell *pVSh = xPara->GetShell();
      91         [ #  # ]:          0 :             if( pVSh )
      92                 :            :             {
      93                 :          0 :                 LoadURL(*pVSh, rINetFmt.GetValue(), URLLOAD_NOFILTER,
      94   [ #  #  #  # ]:          0 :                          rINetFmt.GetTargetFrame());
                 [ #  # ]
      95                 :            :                 OSL_ENSURE( pTxtAttr == rINetFmt.GetTxtINetFmt(),
      96                 :            :                          "lost my txt attr" );
      97                 :          0 :                 const SwTxtINetFmt* pTxtAttr2 = rINetFmt.GetTxtINetFmt();
      98         [ #  # ]:          0 :                 if( pTxtAttr2 )
      99                 :            :                 {
     100                 :          0 :                     const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisited(true);
     101                 :          0 :                     const_cast<SwTxtINetFmt*>(pTxtAttr2)->SetVisitedValid(true);
     102                 :            :                 }
     103                 :          0 :                 bRet = sal_True;
     104                 :            :             }
     105                 :            :         }
     106                 :            :     }
     107                 :            : 
     108         [ #  # ]:          0 :     return bRet;
     109                 :            : }
     110                 :            : 
     111                 :          0 : OUString SAL_CALL SwAccessibleHyperlink::getAccessibleActionDescription(
     112                 :            :         sal_Int32 nIndex )
     113                 :            :         throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     114                 :            : {
     115                 :          0 :     OUString sDesc;
     116                 :            : 
     117         [ #  # ]:          0 :     const SwTxtAttr *pTxtAttr = GetTxtAttr();
     118 [ #  # ][ #  # ]:          0 :     if( pTxtAttr && 0 == nIndex )
     119                 :            :     {
     120                 :          0 :         const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
     121         [ #  # ]:          0 :         sDesc = OUString( rINetFmt.GetValue() );
     122                 :            :     }
     123                 :            : 
     124                 :          0 :     return sDesc;
     125                 :            : }
     126                 :            : 
     127                 :            : uno::Reference< XAccessibleKeyBinding > SAL_CALL
     128                 :          0 :     SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
     129                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     130                 :            : {
     131                 :          0 :     uno::Reference< XAccessibleKeyBinding > xKeyBinding;
     132                 :            : 
     133 [ #  # ][ #  # ]:          0 :     if( isValid() && 0==nIndex )
         [ #  # ][ #  # ]
     134                 :            :     {
     135                 :            :         ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
     136         [ #  # ]:          0 :                new ::comphelper::OAccessibleKeyBindingHelper();
     137 [ #  # ][ #  # ]:          0 :         xKeyBinding = pKeyBindingHelper;
     138                 :            : 
     139                 :          0 :         awt::KeyStroke aKeyStroke;
     140                 :          0 :         aKeyStroke.Modifiers = 0;
     141                 :          0 :         aKeyStroke.KeyCode = KEY_RETURN;
     142                 :          0 :         aKeyStroke.KeyChar = 0;
     143                 :          0 :         aKeyStroke.KeyFunc = 0;
     144         [ #  # ]:          0 :         pKeyBindingHelper->AddKeyBinding( aKeyStroke );
     145                 :            :     }
     146                 :            : 
     147                 :          0 :     return xKeyBinding;
     148                 :            : }
     149                 :            : 
     150                 :            : // XAccessibleHyperlink
     151                 :          0 : uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionAnchor(
     152                 :            :         sal_Int32 /*nIndex*/ )
     153                 :            :         throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     154                 :            : {
     155                 :          0 :     return uno::Any();
     156                 :            : }
     157                 :            : 
     158                 :          0 : uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionObject(
     159                 :            :             sal_Int32 /*nIndex*/ )
     160                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     161                 :            : {
     162                 :          0 :     return uno::Any();
     163                 :            : }
     164                 :            : 
     165                 :          0 : sal_Int32 SAL_CALL SwAccessibleHyperlink::getStartIndex()
     166                 :            :         throw (uno::RuntimeException)
     167                 :            : {
     168                 :          0 :     return nStartIdx;
     169                 :            : }
     170                 :            : 
     171                 :          0 : sal_Int32 SAL_CALL SwAccessibleHyperlink::getEndIndex()
     172                 :            :         throw (uno::RuntimeException)
     173                 :            : {
     174                 :          0 :     return nEndIdx;
     175                 :            : }
     176                 :            : 
     177                 :          0 : sal_Bool SAL_CALL SwAccessibleHyperlink::isValid(  )
     178                 :            :         throw (uno::RuntimeException)
     179                 :            : {
     180         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     181         [ #  # ]:          0 :     return xPara.is();
     182                 :            : }
     183                 :            : 
     184                 :          0 : void SwAccessibleHyperlink::Invalidate()
     185                 :            : {
     186         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     187 [ #  # ][ #  # ]:          0 :     xPara = 0;
     188                 :          0 : }
     189                 :            : 
     190                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10