LCOV - code coverage report
Current view: top level - vcl/unx/gtk/a11y - atkimage.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 46 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 8 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 "atkwrapper.hxx"
      21             : 
      22             : #include <com/sun/star/accessibility/XAccessibleImage.hpp>
      23             : 
      24             : using namespace ::com::sun::star;
      25             : 
      26             : // FIXME
      27             : static G_CONST_RETURN gchar *
      28           0 : getAsConst( const OUString& rString )
      29             : {
      30             :     static const int nMax = 10;
      31           0 :     static OString aUgly[nMax];
      32             :     static int nIdx = 0;
      33           0 :     nIdx = (nIdx + 1) % nMax;
      34           0 :     aUgly[nIdx] = OUStringToOString( rString, RTL_TEXTENCODING_UTF8 );
      35           0 :     return aUgly[ nIdx ].getStr();
      36             : }
      37             : 
      38             : static accessibility::XAccessibleImage*
      39           0 :     getImage( AtkImage *pImage ) throw (uno::RuntimeException)
      40             : {
      41           0 :     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pImage );
      42           0 :     if( pWrap )
      43             :     {
      44           0 :         if( !pWrap->mpImage && pWrap->mpContext )
      45             :         {
      46           0 :             uno::Any any = pWrap->mpContext->queryInterface( cppu::UnoType<accessibility::XAccessibleImage>::get() );
      47           0 :             pWrap->mpImage = static_cast< accessibility::XAccessibleImage * > (any.pReserved);
      48           0 :             pWrap->mpImage->acquire();
      49             :         }
      50             : 
      51           0 :         return pWrap->mpImage;
      52             :     }
      53             : 
      54           0 :     return NULL;
      55             : }
      56             : 
      57             : extern "C" {
      58             : 
      59             : static G_CONST_RETURN gchar *
      60           0 : image_get_image_description( AtkImage *image )
      61             : {
      62             :     try {
      63           0 :         accessibility::XAccessibleImage* pImage = getImage( image );
      64           0 :         if( pImage )
      65           0 :             return getAsConst( pImage->getAccessibleImageDescription() );
      66             :     }
      67           0 :     catch(const uno::Exception&) {
      68           0 :         g_warning( "Exception in getAccessibleImageDescription()" );
      69             :     }
      70             : 
      71           0 :     return NULL;
      72             : }
      73             : 
      74             : static void
      75           0 : image_get_image_position( AtkImage     *image,
      76             :                           gint         *x,
      77             :                           gint         *y,
      78             :                           AtkCoordType  coord_type )
      79             : {
      80           0 :     *x = *y = 0;
      81           0 :     if( ATK_IS_COMPONENT( image ) )
      82             :     {
      83             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
      84           0 :         atk_component_get_position( ATK_COMPONENT( image ), x, y, coord_type );
      85             :         SAL_WNODEPRECATED_DECLARATIONS_POP
      86             :     }
      87             :     else
      88           0 :         g_warning( "FIXME: no image position information" );
      89           0 : }
      90             : 
      91             : static void
      92           0 : image_get_image_size( AtkImage *image,
      93             :                       gint     *width,
      94             :                       gint     *height )
      95             : {
      96           0 :     *width = 0;
      97           0 :     *height = 0;
      98             :     try {
      99           0 :         accessibility::XAccessibleImage* pImage = getImage( image );
     100           0 :         if( pImage )
     101             :         {
     102           0 :             *width = pImage->getAccessibleImageWidth();
     103           0 :             *height = pImage->getAccessibleImageHeight();
     104             :         }
     105             :     }
     106           0 :     catch(const uno::Exception&) {
     107           0 :         g_warning( "Exception in getAccessibleImageHeight() or Width" );
     108             :     }
     109           0 : }
     110             : 
     111             : static gboolean
     112           0 : image_set_image_description( AtkImage *, const gchar * )
     113             : {
     114           0 :     g_warning ("FIXME: no set image description");
     115           0 :     return FALSE;
     116             : }
     117             : 
     118             : } // extern "C"
     119             : 
     120             : void
     121           0 : imageIfaceInit (AtkImageIface *iface)
     122             : {
     123           0 :   g_return_if_fail (iface != NULL);
     124             : 
     125           0 :   iface->set_image_description = image_set_image_description;
     126           0 :   iface->get_image_description = image_get_image_description;
     127           0 :   iface->get_image_position = image_get_image_position;
     128           0 :   iface->get_image_size = image_get_image_size;
     129             : }
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11