LCOV - code coverage report
Current view: top level - sw/source/core/access - accfootnote.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 43 0.0 %
Date: 2014-04-14 Functions: 0 9 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 <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           0 : SwAccessibleFootnote::SwAccessibleFootnote(
      46             :         SwAccessibleMap* pInitMap,
      47             :         sal_Bool bIsEndnote,
      48             :         const SwFtnFrm *pFtnFrm ) :
      49             :     SwAccessibleContext( pInitMap,
      50             :         bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
      51           0 :         pFtnFrm )
      52             : {
      53           0 :     SolarMutexGuard aGuard;
      54             : 
      55             :     sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
      56           0 :                                    : STR_ACCESS_FOOTNOTE_NAME;
      57             : 
      58           0 :     OUString sArg;
      59             :     const SwTxtFtn *pTxtFtn =
      60           0 :         static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
      61           0 :     if( pTxtFtn )
      62             :     {
      63           0 :         const SwDoc *pDoc = GetShell()->GetDoc();
      64           0 :         sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
      65             :     }
      66             : 
      67           0 :     SetName( GetResource( nResId, &sArg ) );
      68           0 : }
      69             : 
      70           0 : SwAccessibleFootnote::~SwAccessibleFootnote()
      71             : {
      72           0 : }
      73             : 
      74           0 : OUString SAL_CALL SwAccessibleFootnote::getAccessibleDescription (void)
      75             :         throw (uno::RuntimeException, std::exception)
      76             : {
      77           0 :     SolarMutexGuard aGuard;
      78             : 
      79           0 :     CHECK_FOR_DEFUNC( XAccessibleContext )
      80             : 
      81           0 :     sal_uInt16 nResId = AccessibleRole::END_NOTE == GetRole()
      82             :         ? STR_ACCESS_ENDNOTE_DESC
      83           0 :         : STR_ACCESS_FOOTNOTE_DESC ;
      84             : 
      85           0 :     OUString sArg;
      86             :     const SwTxtFtn *pTxtFtn =
      87           0 :         static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
      88           0 :     if( pTxtFtn )
      89             :     {
      90           0 :         const SwDoc *pDoc = GetMap()->GetShell()->GetDoc();
      91           0 :         sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
      92             :     }
      93             : 
      94           0 :     return GetResource( nResId, &sArg );
      95             : }
      96             : 
      97           0 : OUString SAL_CALL SwAccessibleFootnote::getImplementationName()
      98             :         throw( RuntimeException, std::exception )
      99             : {
     100           0 :     if( AccessibleRole::END_NOTE == GetRole() )
     101           0 :         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           0 : sal_Bool SwAccessibleFootnote::IsEndnote( const SwFtnFrm *pFtnFrm )
     132             : {
     133           0 :     const SwTxtFtn *pTxtFtn = pFtnFrm ->GetAttr();
     134           0 :     return pTxtFtn && pTxtFtn->GetFtn().IsEndNote() ;
     135             : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10