LCOV - code coverage report
Current view: top level - sw/source/core/access - accfootnote.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 30 43 69.8 %
Date: 2014-04-11 Functions: 6 9 66.7 %
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 <osl/mutex.hxx>
      21             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      22             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      23             : #include <unotools/accessiblestatesethelper.hxx>
      24             : #include <comphelper/servicehelper.hxx>
      25             : #include <cppuhelper/supportsservice.hxx>
      26             : #include <vcl/svapp.hxx>
      27             : #include <ftnfrm.hxx>
      28             : #include <fmtftn.hxx>
      29             : #include <txtftn.hxx>
      30             : #include <viewsh.hxx>
      31             : #include <accmap.hxx>
      32             : #include "accfootnote.hxx"
      33             : #include "access.hrc"
      34             : 
      35             : using namespace ::com::sun::star;
      36             : using namespace ::com::sun::star::uno;
      37             : using namespace ::com::sun::star::lang;
      38             : using namespace ::com::sun::star::accessibility;
      39             : 
      40             : const sal_Char sServiceNameFootnote[] = "com.sun.star.text.AccessibleFootnoteView";
      41             : const sal_Char sServiceNameEndnote[] = "com.sun.star.text.AccessibleEndnoteView";
      42             : const sal_Char sImplementationNameFootnote[] = "com.sun.star.comp.Writer.SwAccessibleFootnoteView";
      43             : const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccessibleEndnoteView";
      44             : 
      45           1 : SwAccessibleFootnote::SwAccessibleFootnote(
      46             :         SwAccessibleMap* pInitMap,
      47             :         sal_Bool bIsEndnote,
      48             :         const SwFtnFrm *pFtnFrm ) :
      49             :     SwAccessibleContext( pInitMap,
      50             :         bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
      51           1 :         pFtnFrm )
      52             : {
      53           1 :     SolarMutexGuard aGuard;
      54             : 
      55             :     sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
      56           1 :                                    : STR_ACCESS_FOOTNOTE_NAME;
      57             : 
      58           2 :     OUString sArg;
      59             :     const SwTxtFtn *pTxtFtn =
      60           1 :         static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
      61           1 :     if( pTxtFtn )
      62             :     {
      63           1 :         const SwDoc *pDoc = GetShell()->GetDoc();
      64           1 :         sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
      65             :     }
      66             : 
      67           2 :     SetName( GetResource( nResId, &sArg ) );
      68           1 : }
      69             : 
      70           2 : SwAccessibleFootnote::~SwAccessibleFootnote()
      71             : {
      72           2 : }
      73             : 
      74           7 : OUString SAL_CALL SwAccessibleFootnote::getAccessibleDescription (void)
      75             :         throw (uno::RuntimeException, std::exception)
      76             : {
      77           7 :     SolarMutexGuard aGuard;
      78             : 
      79           7 :     CHECK_FOR_DEFUNC( XAccessibleContext )
      80             : 
      81           7 :     sal_uInt16 nResId = AccessibleRole::END_NOTE == GetRole()
      82             :         ? STR_ACCESS_ENDNOTE_DESC
      83           7 :         : STR_ACCESS_FOOTNOTE_DESC ;
      84             : 
      85          14 :     OUString sArg;
      86             :     const SwTxtFtn *pTxtFtn =
      87           7 :         static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
      88           7 :     if( pTxtFtn )
      89             :     {
      90           7 :         const SwDoc *pDoc = GetMap()->GetShell()->GetDoc();
      91           7 :         sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
      92             :     }
      93             : 
      94          14 :     return GetResource( nResId, &sArg );
      95             : }
      96             : 
      97           1 : OUString SAL_CALL SwAccessibleFootnote::getImplementationName()
      98             :         throw( RuntimeException, std::exception )
      99             : {
     100           1 :     if( AccessibleRole::END_NOTE == GetRole() )
     101           1 :         return OUString(sImplementationNameEndnote);
     102             :     else
     103           0 :         return OUString(sImplementationNameFootnote);
     104             : }
     105             : 
     106           0 : sal_Bool SAL_CALL SwAccessibleFootnote::supportsService(const OUString& sTestServiceName)
     107             :     throw (uno::RuntimeException, std::exception)
     108             : {
     109           0 :     return cppu::supportsService(this, sTestServiceName);
     110             : }
     111             : 
     112           0 : Sequence< OUString > SAL_CALL SwAccessibleFootnote::getSupportedServiceNames()
     113             :         throw( uno::RuntimeException, std::exception )
     114             : {
     115           0 :     Sequence< OUString > aRet(2);
     116           0 :     OUString* pArray = aRet.getArray();
     117           0 :     if( AccessibleRole::END_NOTE == GetRole() )
     118           0 :         pArray[0] = OUString( sServiceNameEndnote );
     119             :     else
     120           0 :         pArray[0] = OUString( sServiceNameFootnote );
     121           0 :     pArray[1] = OUString( sAccessibleServiceName );
     122           0 :     return aRet;
     123             : }
     124             : 
     125           0 : Sequence< sal_Int8 > SAL_CALL SwAccessibleFootnote::getImplementationId()
     126             :         throw(RuntimeException, std::exception)
     127             : {
     128           0 :     return css::uno::Sequence<sal_Int8>();
     129             : }
     130             : 
     131           1 : sal_Bool SwAccessibleFootnote::IsEndnote( const SwFtnFrm *pFtnFrm )
     132             : {
     133           1 :     const SwTxtFtn *pTxtFtn = pFtnFrm ->GetAttr();
     134           1 :     return pTxtFtn && pTxtFtn->GetFtn().IsEndNote() ;
     135             : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10