LCOV - code coverage report
Current view: top level - svx/source/accessibility - AccessibleGraphicShape.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 64 0.0 %
Date: 2014-04-14 Functions: 0 15 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 <svx/AccessibleGraphicShape.hxx>
      21             : 
      22             : #include <svx/ShapeTypeHandler.hxx>
      23             : #include <svx/SvxShapeTypes.hxx>
      24             : #include <svx/svdobj.hxx>
      25             : #include <svx/svdmodel.hxx>
      26             : 
      27             : using namespace ::accessibility;
      28             : using namespace ::rtl;
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::accessibility;
      31             : 
      32             : //=====  internal  ============================================================
      33             : 
      34           0 : AccessibleGraphicShape::AccessibleGraphicShape (
      35             :     const AccessibleShapeInfo& rShapeInfo,
      36             :     const AccessibleShapeTreeInfo& rShapeTreeInfo)
      37           0 :     : AccessibleShape (rShapeInfo, rShapeTreeInfo)
      38             : {
      39           0 : }
      40             : 
      41             : 
      42             : 
      43             : 
      44           0 : AccessibleGraphicShape::~AccessibleGraphicShape (void)
      45             : {
      46           0 : }
      47             : 
      48             : 
      49             : 
      50             : 
      51             : //=====  XAccessibleImage  ====================================================
      52             : 
      53           0 : OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void)
      54             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      55             : {
      56           0 :     if (m_pShape)
      57           0 :         return m_pShape->GetTitle();
      58           0 :     return AccessibleShape::getAccessibleDescription ();
      59             : }
      60             : 
      61             : 
      62             : 
      63             : 
      64           0 : sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageHeight (void)
      65             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      66             : {
      67           0 :     return AccessibleShape::getSize().Height;
      68             : }
      69             : 
      70             : 
      71             : 
      72             : 
      73           0 : sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageWidth (void)
      74             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      75             : {
      76           0 :     return AccessibleShape::getSize().Width;
      77             : }
      78             : 
      79             : 
      80             : 
      81             : 
      82             : //=====  XInterface  ==========================================================
      83             : 
      84             : com::sun::star::uno::Any SAL_CALL
      85           0 :     AccessibleGraphicShape::queryInterface (const com::sun::star::uno::Type & rType)
      86             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      87             : {
      88           0 :     ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
      89           0 :     if ( ! aReturn.hasValue())
      90           0 :         aReturn = ::cppu::queryInterface (rType,
      91           0 :             static_cast<XAccessibleImage*>(this));
      92           0 :     return aReturn;
      93             : }
      94             : 
      95             : 
      96             : 
      97             : void SAL_CALL
      98           0 :     AccessibleGraphicShape::acquire (void)
      99             :     throw ()
     100             : {
     101           0 :     AccessibleShape::acquire ();
     102           0 : }
     103             : 
     104             : 
     105             : 
     106             : void SAL_CALL
     107           0 :     AccessibleGraphicShape::release (void)
     108             :     throw ()
     109             : {
     110           0 :     AccessibleShape::release ();
     111           0 : }
     112             : 
     113             : 
     114             : 
     115             : 
     116             : //=====  XServiceInfo  ========================================================
     117             : 
     118             : OUString SAL_CALL
     119           0 :     AccessibleGraphicShape::getImplementationName (void)
     120             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     121             : {
     122           0 :     return OUString("AccessibleGraphicShape");
     123             : }
     124             : 
     125             : 
     126             : 
     127             : 
     128             : ::com::sun::star::uno::Sequence< OUString> SAL_CALL
     129           0 :     AccessibleGraphicShape::getSupportedServiceNames (void)
     130             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     131             : {
     132           0 :     ThrowIfDisposed ();
     133             :     // Get list of supported service names from base class...
     134             :     uno::Sequence<OUString> aServiceNames =
     135           0 :         AccessibleShape::getSupportedServiceNames();
     136           0 :     sal_Int32 nCount (aServiceNames.getLength());
     137             : 
     138             :     // ...and add additional names.
     139           0 :     aServiceNames.realloc (nCount + 1);
     140           0 :     static const OUString sAdditionalServiceName ("com.sun.star.drawing.AccessibleGraphicShape");
     141           0 :     aServiceNames[nCount] = sAdditionalServiceName;
     142             : 
     143           0 :     return aServiceNames;
     144             : }
     145             : 
     146             : 
     147             : 
     148             : 
     149             : //=====  XTypeProvider  ===================================================
     150             : 
     151             : uno::Sequence<uno::Type> SAL_CALL
     152           0 :     AccessibleGraphicShape::getTypes (void)
     153             :     throw (uno::RuntimeException, std::exception)
     154             : {
     155             :     // Get list of types from the context base implementation...
     156           0 :     uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
     157             :     // ...and add the additional type for the component.
     158           0 :     long nTypeCount = aTypeList.getLength();
     159           0 :     aTypeList.realloc (nTypeCount + 1);
     160             :     const uno::Type aImageType =
     161           0 :         ::getCppuType((const uno::Reference<XAccessibleImage>*)0);
     162           0 :     aTypeList[nTypeCount] = aImageType;
     163             : 
     164           0 :     return aTypeList;
     165             : }
     166             : 
     167             : 
     168             : 
     169             : 
     170             : /// Create the base name of this object, i.e. the name without appended number.
     171             : OUString
     172           0 :     AccessibleGraphicShape::CreateAccessibleBaseName (void)
     173             :     throw (::com::sun::star::uno::RuntimeException)
     174             : {
     175           0 :     OUString sName;
     176             : 
     177           0 :     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
     178           0 :     switch (nShapeType)
     179             :     {
     180             :         case DRAWING_GRAPHIC_OBJECT:
     181           0 :             sName = "GraphicObjectShape";
     182           0 :             break;
     183             : 
     184             :         default:
     185           0 :             sName = "UnknownAccessibleGraphicShape";
     186           0 :             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
     187           0 :             if (xDescriptor.is())
     188           0 :                 sName += ": " + xDescriptor->getShapeType();
     189             :     }
     190             : 
     191           0 :     return sName;
     192             : }
     193             : 
     194           0 : OUString AccessibleGraphicShape::CreateAccessibleDescription (void)
     195             :     throw (::com::sun::star::uno::RuntimeException)
     196             : {
     197             :     //Don't use the same information for accessible name and accessible description.
     198           0 :     OUString sDesc;
     199           0 :     if (m_pShape)
     200           0 :         sDesc =  m_pShape->GetTitle();
     201           0 :     if (!sDesc.isEmpty())
     202           0 :         return sDesc;
     203           0 :     return CreateAccessibleBaseName();
     204             : }
     205             : 
     206             : //  Return this object's role.
     207           0 : sal_Int16 SAL_CALL AccessibleGraphicShape::getAccessibleRole (void)
     208             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     209             : {
     210           0 :     if( m_pShape->GetModel()->GetImageMapForObject(m_pShape) != NULL )
     211           0 :         return AccessibleRole::IMAGE_MAP;
     212             :     else
     213           0 :         return AccessibleShape::getAccessibleRole();
     214             : }
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10