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

Generated by: LCOV version 1.10