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

Generated by: LCOV version 1.10