LCOV - code coverage report
Current view: top level - vcl/unx/gtk/a11y - atkimage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 46 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "atkwrapper.hxx"
      31                 :            : 
      32                 :            : #include <com/sun/star/accessibility/XAccessibleImage.hpp>
      33                 :            : 
      34                 :            : #include <stdio.h>
      35                 :            : 
      36                 :            : using namespace ::com::sun::star;
      37                 :            : 
      38                 :            : // FIXME
      39                 :            : static G_CONST_RETURN gchar *
      40                 :          0 : getAsConst( rtl::OUString rString )
      41                 :            : {
      42                 :            :     static const int nMax = 10;
      43                 :          0 :     static rtl::OString aUgly[nMax];
      44                 :            :     static int nIdx = 0;
      45                 :          0 :     nIdx = (nIdx + 1) % nMax;
      46                 :          0 :     aUgly[nIdx] = rtl::OUStringToOString( rString, RTL_TEXTENCODING_UTF8 );
      47                 :          0 :     return aUgly[ nIdx ].getStr();
      48                 :            : }
      49                 :            : 
      50                 :            : static accessibility::XAccessibleImage*
      51                 :          0 :     getImage( AtkImage *pImage ) throw (uno::RuntimeException)
      52                 :            : {
      53                 :          0 :     AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER( pImage );
      54                 :          0 :     if( pWrap )
      55                 :            :     {
      56                 :          0 :         if( !pWrap->mpImage && pWrap->mpContext )
      57                 :            :         {
      58                 :          0 :             uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleImage::static_type(NULL) );
      59                 :          0 :             pWrap->mpImage = reinterpret_cast< accessibility::XAccessibleImage * > (any.pReserved);
      60                 :          0 :             pWrap->mpImage->acquire();
      61                 :            :         }
      62                 :            : 
      63                 :          0 :         return pWrap->mpImage;
      64                 :            :     }
      65                 :            : 
      66                 :          0 :     return NULL;
      67                 :            : }
      68                 :            : 
      69                 :            : extern "C" {
      70                 :            : 
      71                 :            : static G_CONST_RETURN gchar *
      72                 :          0 : image_get_image_description( AtkImage *image )
      73                 :            : {
      74                 :            :     try {
      75                 :          0 :         accessibility::XAccessibleImage* pImage = getImage( image );
      76                 :          0 :         if( pImage )
      77                 :          0 :             return getAsConst( pImage->getAccessibleImageDescription() );
      78                 :            :     }
      79                 :          0 :     catch(const uno::Exception& e) {
      80                 :          0 :         g_warning( "Exception in getAccessibleImageDescription()" );
      81                 :            :     }
      82                 :            : 
      83                 :          0 :     return NULL;
      84                 :            : }
      85                 :            : 
      86                 :            : static void
      87                 :          0 : image_get_image_position( AtkImage     *image,
      88                 :            :                           gint         *x,
      89                 :            :                           gint         *y,
      90                 :            :                           AtkCoordType  coord_type )
      91                 :            : {
      92                 :          0 :     *x = *y = 0;
      93                 :          0 :     if( ATK_IS_COMPONENT( image ) )
      94                 :          0 :         atk_component_get_position( ATK_COMPONENT( image ), x, y, coord_type );
      95                 :            :     else
      96                 :          0 :         g_warning( "FIXME: no image position information" );
      97                 :          0 : }
      98                 :            : 
      99                 :            : static void
     100                 :          0 : image_get_image_size( AtkImage *image,
     101                 :            :                       gint     *width,
     102                 :            :                       gint     *height )
     103                 :            : {
     104                 :          0 :     *width = 0;
     105                 :          0 :     *height = 0;
     106                 :            :     try {
     107                 :          0 :         accessibility::XAccessibleImage* pImage = getImage( image );
     108                 :          0 :         if( pImage )
     109                 :            :         {
     110                 :          0 :             *width = pImage->getAccessibleImageWidth();
     111                 :          0 :             *height = pImage->getAccessibleImageHeight();
     112                 :            :         }
     113                 :            :     }
     114                 :          0 :     catch(const uno::Exception& e) {
     115                 :          0 :         g_warning( "Exception in getAccessibleImageHeight() or Width" );
     116                 :            :     }
     117                 :          0 : }
     118                 :            : 
     119                 :            : static gboolean
     120                 :          0 : image_set_image_description( AtkImage *, const gchar * )
     121                 :            : {
     122                 :          0 :     g_warning ("FIXME: no set image description");
     123                 :          0 :     return FALSE;
     124                 :            : }
     125                 :            : 
     126                 :            : } // extern "C"
     127                 :            : 
     128                 :            : void
     129                 :          0 : imageIfaceInit (AtkImageIface *iface)
     130                 :            : {
     131                 :          0 :   g_return_if_fail (iface != NULL);
     132                 :            : 
     133                 :          0 :   iface->set_image_description = image_set_image_description;
     134                 :          0 :   iface->get_image_description = image_get_image_description;
     135                 :          0 :   iface->get_image_position = image_get_image_position;
     136                 :          0 :   iface->get_image_size = image_get_image_size;
     137                 :            : }
     138                 :            : 
     139                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10