LCOV - code coverage report
Current view: top level - editeng/source/accessibility - AccessibleImageBullet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 213 0.0 %
Date: 2012-08-25 Functions: 0 46 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 308 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                 :            : #include <tools/gen.hxx>
      30                 :            : #include <osl/mutex.hxx>
      31                 :            : #include <vcl/svapp.hxx>
      32                 :            : #include <rtl/ustring.hxx>
      33                 :            : #include <com/sun/star/awt/Point.hpp>
      34                 :            : #include <com/sun/star/awt/Rectangle.hpp>
      35                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      36                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      37                 :            : #include <com/sun/star/accessibility/AccessibleTextType.hpp>
      38                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      39                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      40                 :            : #include <comphelper/accessibleeventnotifier.hxx>
      41                 :            : #include <unotools/accessiblestatesethelper.hxx>
      42                 :            : #include <editeng/unolingu.hxx>
      43                 :            : #include "editeng/AccessibleEditableTextPara.hxx"
      44                 :            : #include "editeng/AccessibleImageBullet.hxx"
      45                 :            : #include <editeng/eerdll.hxx>
      46                 :            : 
      47                 :            : #include <editeng/editdata.hxx>
      48                 :            : #include <editeng/editeng.hxx>
      49                 :            : #include <editeng/outliner.hxx>
      50                 :            : #include "editeng.hrc"
      51                 :            : #include <svtools/colorcfg.hxx>
      52                 :            : 
      53                 :            : 
      54                 :            : using namespace ::com::sun::star;
      55                 :            : using namespace ::com::sun::star::accessibility;
      56                 :            : 
      57                 :            : namespace accessibility
      58                 :            : {
      59                 :            :     DBG_NAME( AccessibleImageBullet )
      60                 :            : 
      61                 :          0 :     AccessibleImageBullet::AccessibleImageBullet ( const uno::Reference< XAccessible >& rParent ) :
      62                 :            :         mnParagraphIndex( 0 ),
      63                 :            :         mnIndexInParent( 0 ),
      64                 :            :         mpEditSource( NULL ),
      65                 :            :         maEEOffset( 0, 0 ),
      66                 :            :         mxParent( rParent ),
      67                 :            :         // well, that's strictly (UNO) exception safe, though not
      68                 :            :         // really robust. We rely on the fact that this member is
      69                 :            :         // constructed last, and that the constructor body catches
      70                 :            :         // exceptions, thus no chance for exceptions once the Id is
      71                 :            :         // fetched. Nevertheless, normally should employ RAII here...
      72 [ #  # ][ #  # ]:          0 :         mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient())
      73                 :            :     {
      74                 :            : #ifdef DBG_UTIL
      75                 :            :         DBG_CTOR( AccessibleImageBullet, NULL );
      76                 :            :         OSL_TRACE( "Received ID: %d", mnNotifierClientId );
      77                 :            : #endif
      78                 :            : 
      79                 :            :         try
      80                 :            :         {
      81                 :            :             // Create the state set.
      82   [ #  #  #  # ]:          0 :             ::utl::AccessibleStateSetHelper* pStateSet  = new ::utl::AccessibleStateSetHelper ();
      83 [ #  # ][ #  # ]:          0 :             mxStateSet = pStateSet;
      84                 :            : 
      85                 :            :             // these are always on
      86         [ #  # ]:          0 :             pStateSet->AddState( AccessibleStateType::VISIBLE );
      87         [ #  # ]:          0 :             pStateSet->AddState( AccessibleStateType::SHOWING );
      88         [ #  # ]:          0 :             pStateSet->AddState( AccessibleStateType::ENABLED );
      89         [ #  # ]:          0 :             pStateSet->AddState( AccessibleStateType::SENSITIVE );
      90                 :            :         }
      91         [ #  # ]:          0 :         catch( const uno::Exception& ) {}
      92                 :          0 :     }
      93                 :            : 
      94         [ #  # ]:          0 :     AccessibleImageBullet::~AccessibleImageBullet()
      95                 :            :     {
      96                 :            :         DBG_DTOR( AccessibleImageBullet, NULL );
      97                 :            : 
      98                 :            :         // sign off from event notifier
      99         [ #  # ]:          0 :         if( getNotifierClientId() != -1 )
     100                 :            :         {
     101                 :            :             try
     102                 :            :             {
     103         [ #  # ]:          0 :                 ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() );
     104                 :            : #ifdef DBG_UTIL
     105                 :            :                 OSL_TRACE( "AccessibleImageBullet revoked ID: %d", mnNotifierClientId );
     106                 :            : #endif
     107                 :            :             }
     108         [ #  # ]:          0 :             catch( const uno::Exception& ) {}
     109                 :            :         }
     110 [ #  # ][ #  # ]:          0 :     }
     111                 :            : 
     112                 :          0 :     uno::Any SAL_CALL AccessibleImageBullet::queryInterface (const uno::Type & rType) throw (uno::RuntimeException)
     113                 :            :     {
     114                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     115                 :            : 
     116                 :          0 :         return AccessibleImageBulletInterfaceBase::queryInterface(rType);
     117                 :            :     }
     118                 :            : 
     119                 :          0 :     uno::Reference< XAccessibleContext > SAL_CALL AccessibleImageBullet::getAccessibleContext(  ) throw (uno::RuntimeException)
     120                 :            :     {
     121                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     122                 :            : 
     123                 :            :         // We implement the XAccessibleContext interface in the same object
     124                 :          0 :         return uno::Reference< XAccessibleContext > ( this );
     125                 :            :     }
     126                 :            : 
     127                 :          0 :     sal_Int32 SAL_CALL  AccessibleImageBullet::getAccessibleChildCount() throw (uno::RuntimeException)
     128                 :            :     {
     129                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     130                 :            : 
     131                 :          0 :         return 0;
     132                 :            :     }
     133                 :            : 
     134                 :          0 :     uno::Reference< XAccessible > SAL_CALL  AccessibleImageBullet::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     135                 :            :     {
     136                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     137                 :            :         (void)i;
     138                 :            : 
     139                 :            :         throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No children available")),
     140                 :            :                                               uno::Reference< uno::XInterface >
     141 [ #  # ][ #  # ]:          0 :                                               ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy
                 [ #  # ]
     142                 :            :     }
     143                 :            : 
     144                 :          0 :     uno::Reference< XAccessible > SAL_CALL  AccessibleImageBullet::getAccessibleParent() throw (uno::RuntimeException)
     145                 :            :     {
     146                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     147                 :            : 
     148                 :          0 :         return mxParent;
     149                 :            :     }
     150                 :            : 
     151                 :          0 :     sal_Int32 SAL_CALL  AccessibleImageBullet::getAccessibleIndexInParent() throw (uno::RuntimeException)
     152                 :            :     {
     153                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     154                 :            : 
     155                 :          0 :         return mnIndexInParent;
     156                 :            :     }
     157                 :            : 
     158                 :          0 :     sal_Int16 SAL_CALL  AccessibleImageBullet::getAccessibleRole() throw (uno::RuntimeException)
     159                 :            :     {
     160                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     161                 :            : 
     162                 :          0 :         return AccessibleRole::GRAPHIC;
     163                 :            :     }
     164                 :            : 
     165                 :          0 :     ::rtl::OUString SAL_CALL  AccessibleImageBullet::getAccessibleDescription() throw (uno::RuntimeException)
     166                 :            :     {
     167                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     168                 :            : 
     169         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     170                 :            : 
     171                 :            :         // Get the string from the resource for the specified id.
     172 [ #  # ][ #  # ]:          0 :         return EE_RESSTR(RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION);
                 [ #  # ]
     173                 :            :     }
     174                 :            : 
     175                 :          0 :     ::rtl::OUString SAL_CALL  AccessibleImageBullet::getAccessibleName() throw (uno::RuntimeException)
     176                 :            :     {
     177                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     178                 :            : 
     179         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     180                 :            : 
     181                 :            :         // Get the string from the resource for the specified id.
     182 [ #  # ][ #  # ]:          0 :         return EE_RESSTR(RID_SVXSTR_A11Y_IMAGEBULLET_NAME);
                 [ #  # ]
     183                 :            :     }
     184                 :            : 
     185                 :          0 :     uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleImageBullet::getAccessibleRelationSet() throw (uno::RuntimeException)
     186                 :            :     {
     187                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     188                 :            : 
     189                 :            :         // no relations, therefore empty
     190                 :          0 :         return uno::Reference< XAccessibleRelationSet >();
     191                 :            :     }
     192                 :            : 
     193                 :          0 :     uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleImageBullet::getAccessibleStateSet() throw (uno::RuntimeException)
     194                 :            :     {
     195                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     196                 :            : 
     197         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     198                 :            : 
     199                 :            :         // Create a copy of the state set and return it.
     200 [ #  # ][ #  # ]:          0 :         ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     201                 :            : 
     202         [ #  # ]:          0 :         if( !pStateSet )
     203                 :          0 :             return uno::Reference<XAccessibleStateSet>();
     204                 :            : 
     205 [ #  # ][ #  # ]:          0 :         return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
         [ #  # ][ #  # ]
     206                 :            :     }
     207                 :            : 
     208                 :          0 :     lang::Locale SAL_CALL AccessibleImageBullet::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
     209                 :            :     {
     210                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     211                 :            : 
     212         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     213                 :            : 
     214                 :          0 :         lang::Locale        aLocale;
     215                 :            : 
     216                 :            :         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
     217                 :            :                    "AccessibleImageBullet::getLocale: paragraph index value overflow");
     218                 :            : 
     219                 :            :         // return locale of first character in the paragraph
     220 [ #  # ][ #  # ]:          0 :         return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 ));
         [ #  # ][ #  # ]
     221                 :            :     }
     222                 :            : 
     223                 :          0 :     void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
     224                 :            :     {
     225                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     226                 :            : 
     227         [ #  # ]:          0 :         if( getNotifierClientId() != -1 )
     228                 :          0 :             ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener );
     229                 :          0 :     }
     230                 :            : 
     231                 :          0 :     void SAL_CALL AccessibleImageBullet::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
     232                 :            :     {
     233                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     234                 :            : 
     235         [ #  # ]:          0 :         if( getNotifierClientId() != -1 )
     236                 :          0 :             ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
     237                 :          0 :     }
     238                 :            : 
     239                 :          0 :     sal_Bool SAL_CALL AccessibleImageBullet::containsPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
     240                 :            :     {
     241                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     242                 :            : 
     243         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     244                 :            : 
     245                 :            :         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
     246                 :            :                    "AccessibleEditableTextPara::contains: index value overflow");
     247                 :            : 
     248         [ #  # ]:          0 :         awt::Rectangle aTmpRect = getBounds();
     249         [ #  # ]:          0 :         Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) );
     250                 :          0 :         Point aPoint( rPoint.X, rPoint.Y );
     251                 :            : 
     252 [ #  # ][ #  # ]:          0 :         return aRect.IsInside( aPoint );
     253                 :            :     }
     254                 :            : 
     255                 :          0 :     uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) throw (uno::RuntimeException)
     256                 :            :     {
     257                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     258                 :            : 
     259                 :            :         // as we have no children, empty reference
     260                 :          0 :         return uno::Reference< XAccessible >();
     261                 :            :     }
     262                 :            : 
     263                 :          0 :     awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds(  ) throw (uno::RuntimeException)
     264                 :            :     {
     265                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     266                 :            : 
     267         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     268                 :            : 
     269                 :            :         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
     270                 :            :                    "AccessibleEditableTextPara::getBounds: index value overflow");
     271                 :            : 
     272         [ #  # ]:          0 :         SvxTextForwarder& rCacheTF = GetTextForwarder();
     273         [ #  # ]:          0 :         EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) );
     274         [ #  # ]:          0 :         Rectangle aParentRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
     275                 :            : 
     276 [ #  # ][ #  # ]:          0 :         if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
                 [ #  # ]
     277                 :            :             aBulletInfo.bVisible &&
     278                 :            :             aBulletInfo.nType == SVX_NUM_BITMAP )
     279                 :            :         {
     280                 :          0 :             Rectangle aRect = aBulletInfo.aBounds;
     281                 :            : 
     282                 :            :             // subtract paragraph position (bullet pos is absolute in EditEngine/Outliner)
     283         [ #  # ]:          0 :             aRect.Move( -aParentRect.Left(), -aParentRect.Top() );
     284                 :            : 
     285                 :            :             // convert to screen coordinates
     286                 :            :             Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
     287                 :          0 :                                                                               rCacheTF.GetMapMode(),
     288 [ #  # ][ #  # ]:          0 :                                                                               GetViewForwarder() );
         [ #  # ][ #  # ]
     289                 :            : 
     290                 :            :             // offset from shape/cell
     291                 :          0 :             Point aOffset = GetEEOffset();
     292                 :            : 
     293                 :          0 :             return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
     294                 :          0 :                                    aScreenRect.Top() + aOffset.Y(),
     295         [ #  # ]:          0 :                                    aScreenRect.GetSize().Width(),
     296         [ #  # ]:          0 :                                    aScreenRect.GetSize().Height() );
     297                 :            :         }
     298                 :            : 
     299 [ #  # ][ #  # ]:          0 :         return awt::Rectangle();
     300                 :            :     }
     301                 :            : 
     302                 :          0 :     awt::Point SAL_CALL AccessibleImageBullet::getLocation(  ) throw (uno::RuntimeException)
     303                 :            :     {
     304                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     305                 :            : 
     306         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     307                 :            : 
     308         [ #  # ]:          0 :         awt::Rectangle aRect = getBounds();
     309                 :            : 
     310         [ #  # ]:          0 :         return awt::Point( aRect.X, aRect.Y );
     311                 :            :     }
     312                 :            : 
     313                 :          0 :     awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen(  ) throw (uno::RuntimeException)
     314                 :            :     {
     315                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     316                 :            : 
     317         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     318                 :            : 
     319                 :            :         // relate us to parent
     320         [ #  # ]:          0 :         uno::Reference< XAccessible > xParent = getAccessibleParent();
     321         [ #  # ]:          0 :         if( xParent.is() )
     322                 :            :         {
     323         [ #  # ]:          0 :             uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
     324         [ #  # ]:          0 :             if( xParentComponent.is() )
     325                 :            :             {
     326 [ #  # ][ #  # ]:          0 :                 awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
     327         [ #  # ]:          0 :                 awt::Point aPoint = getLocation();
     328                 :          0 :                 aPoint.X += aRefPoint.X;
     329                 :          0 :                 aPoint.Y += aRefPoint.Y;
     330                 :            : 
     331                 :          0 :                 return aPoint;
     332         [ #  # ]:          0 :             }
     333                 :            :         }
     334                 :            : 
     335                 :            :         throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")),
     336                 :            :                                     uno::Reference< uno::XInterface >
     337 [ #  # ][ #  # ]:          0 :                                     ( static_cast< XAccessible* > (this) ) );   // disambiguate hierarchy
         [ #  # ][ #  # ]
     338                 :            :     }
     339                 :            : 
     340                 :          0 :     awt::Size SAL_CALL AccessibleImageBullet::getSize(  ) throw (uno::RuntimeException)
     341                 :            :     {
     342                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     343                 :            : 
     344         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     345                 :            : 
     346         [ #  # ]:          0 :         awt::Rectangle aRect = getBounds();
     347                 :            : 
     348         [ #  # ]:          0 :         return awt::Size( aRect.Width, aRect.Height );
     349                 :            :     }
     350                 :            : 
     351                 :          0 :     void SAL_CALL AccessibleImageBullet::grabFocus(  ) throw (uno::RuntimeException)
     352                 :            :     {
     353                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     354                 :            : 
     355                 :            :         throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")),
     356                 :            :                                     uno::Reference< uno::XInterface >
     357 [ #  # ][ #  # ]:          0 :                                     ( static_cast< XAccessible* > (this) ) );   // disambiguate hierarchy
                 [ #  # ]
     358                 :            :     }
     359                 :            : 
     360                 :          0 :     sal_Int32 SAL_CALL AccessibleImageBullet::getForeground(  ) throw (::com::sun::star::uno::RuntimeException)
     361                 :            :     {
     362                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     363                 :            : 
     364                 :            :         // #104444# Added to XAccessibleComponent interface
     365         [ #  # ]:          0 :         svtools::ColorConfig aColorConfig;
     366         [ #  # ]:          0 :         sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     367         [ #  # ]:          0 :         return static_cast<sal_Int32>(nColor);
     368                 :            :     }
     369                 :            : 
     370                 :          0 :     sal_Int32 SAL_CALL AccessibleImageBullet::getBackground(  ) throw (::com::sun::star::uno::RuntimeException)
     371                 :            :     {
     372                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     373                 :            : 
     374                 :            :         // #104444# Added to XAccessibleComponent interface
     375         [ #  # ]:          0 :         Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() );
     376                 :            : 
     377                 :            :         // the background is transparent
     378         [ #  # ]:          0 :         aColor.SetTransparency( 0xFF);
     379                 :            : 
     380                 :          0 :         return static_cast<sal_Int32>( aColor.GetColor() );
     381                 :            :     }
     382                 :            : 
     383                 :          0 :     ::rtl::OUString SAL_CALL AccessibleImageBullet::getImplementationName (void) throw (uno::RuntimeException)
     384                 :            :     {
     385                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     386                 :            : 
     387                 :          0 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleImageBullet"));
     388                 :            :     }
     389                 :            : 
     390                 :          0 :     sal_Bool SAL_CALL AccessibleImageBullet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
     391                 :            :     {
     392                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     393                 :            : 
     394                 :            :         //  Iterate over all supported service names and return true if on of them
     395                 :            :         //  matches the given name.
     396                 :            :         uno::Sequence< ::rtl::OUString> aSupportedServices (
     397         [ #  # ]:          0 :             getSupportedServiceNames ());
     398         [ #  # ]:          0 :         for (int i=0; i<aSupportedServices.getLength(); i++)
     399 [ #  # ][ #  # ]:          0 :             if (sServiceName == aSupportedServices[i])
     400                 :          0 :                 return sal_True;
     401         [ #  # ]:          0 :         return sal_False;
     402                 :            :     }
     403                 :            : 
     404                 :          0 :     uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleImageBullet::getSupportedServiceNames (void) throw (uno::RuntimeException)
     405                 :            :     {
     406                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     407                 :            : 
     408         [ #  # ]:          0 :         const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext"));
     409         [ #  # ]:          0 :         return uno::Sequence< ::rtl::OUString > (&sServiceName, 1);
     410                 :            :     }
     411                 :            : 
     412                 :          0 :     ::rtl::OUString SAL_CALL AccessibleImageBullet::getServiceName (void) throw (uno::RuntimeException)
     413                 :            :     {
     414                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     415                 :            : 
     416                 :          0 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext"));
     417                 :            :     }
     418                 :            : 
     419                 :          0 :     void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex )
     420                 :            :     {
     421                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     422                 :            : 
     423                 :          0 :         mnIndexInParent = nIndex;
     424                 :          0 :     }
     425                 :            : 
     426                 :          0 :     void AccessibleImageBullet::SetEEOffset( const Point& rOffset )
     427                 :            :     {
     428                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     429                 :            : 
     430                 :          0 :         maEEOffset = rOffset;
     431                 :          0 :     }
     432                 :            : 
     433                 :          0 :     void AccessibleImageBullet::Dispose()
     434                 :            :     {
     435                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     436                 :            : 
     437                 :          0 :         int nClientId( getNotifierClientId() );
     438                 :            : 
     439                 :            :         // #108212# drop all references before notifying dispose
     440                 :          0 :         mxParent = NULL;
     441                 :          0 :         mnNotifierClientId = -1;
     442                 :          0 :         mpEditSource = NULL;
     443                 :            : 
     444                 :            :         // notify listeners
     445         [ #  # ]:          0 :         if( nClientId != -1 )
     446                 :            :         {
     447                 :            :             try
     448                 :            :             {
     449         [ #  # ]:          0 :                 uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
     450                 :            : 
     451                 :            :                 // #106234# Delegate to EventNotifier
     452 [ #  # ][ #  # ]:          0 :                 ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
     453                 :            : #ifdef DBG_UTIL
     454                 :            :                 OSL_TRACE( "AccessibleImageBullet disposed ID: %d", nClientId );
     455                 :            : #endif
     456                 :            :             }
     457                 :          0 :             catch( const uno::Exception& ) {}
     458                 :            :         }
     459                 :          0 :     }
     460                 :            : 
     461                 :          0 :     void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource )
     462                 :            :     {
     463                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     464                 :            : 
     465                 :          0 :         mpEditSource = pEditSource;
     466                 :            : 
     467         [ #  # ]:          0 :         if( !mpEditSource )
     468                 :            :         {
     469                 :            :             // going defunc
     470                 :          0 :             UnSetState( AccessibleStateType::SHOWING );
     471                 :          0 :             UnSetState( AccessibleStateType::VISIBLE );
     472                 :          0 :             SetState( AccessibleStateType::INVALID );
     473                 :          0 :             SetState( AccessibleStateType::DEFUNC );
     474                 :            : 
     475                 :          0 :             Dispose();
     476                 :            :         }
     477                 :          0 :     }
     478                 :            : 
     479                 :          0 :     void AccessibleImageBullet::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
     480                 :            :     {
     481                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     482                 :            : 
     483         [ #  # ]:          0 :         uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() );
     484                 :            : 
     485         [ #  # ]:          0 :         AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue);
     486                 :            : 
     487                 :            :         // #106234# Delegate to EventNotifier
     488                 :          0 :         ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(),
     489 [ #  # ][ #  # ]:          0 :                                                          aEvent );
     490                 :          0 :     }
     491                 :            : 
     492                 :          0 :     void AccessibleImageBullet::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const
     493                 :            :     {
     494                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     495                 :            : 
     496         [ #  # ]:          0 :         FireEvent( nEventId, rNewValue );
     497                 :          0 :     }
     498                 :            : 
     499                 :          0 :     void AccessibleImageBullet::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const
     500                 :            :     {
     501                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     502                 :            : 
     503         [ #  # ]:          0 :         FireEvent( nEventId, uno::Any(), rOldValue );
     504                 :          0 :     }
     505                 :            : 
     506                 :          0 :     void AccessibleImageBullet::SetState( const sal_Int16 nStateId )
     507                 :            :     {
     508                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     509                 :            : 
     510         [ #  # ]:          0 :         ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     511   [ #  #  #  # ]:          0 :         if( pStateSet != NULL &&
                 [ #  # ]
     512                 :          0 :             !pStateSet->contains(nStateId) )
     513                 :            :         {
     514                 :          0 :             pStateSet->AddState( nStateId );
     515         [ #  # ]:          0 :             GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
     516                 :            :         }
     517                 :          0 :     }
     518                 :            : 
     519                 :          0 :     void AccessibleImageBullet::UnSetState( const sal_Int16 nStateId )
     520                 :            :     {
     521                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     522                 :            : 
     523         [ #  # ]:          0 :         ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     524   [ #  #  #  # ]:          0 :         if( pStateSet != NULL &&
                 [ #  # ]
     525                 :          0 :             pStateSet->contains(nStateId) )
     526                 :            :         {
     527                 :          0 :             pStateSet->RemoveState( nStateId );
     528         [ #  # ]:          0 :             LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
     529                 :            :         }
     530                 :          0 :     }
     531                 :            : 
     532                 :          0 :     int AccessibleImageBullet::getNotifierClientId() const
     533                 :            :     {
     534                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     535                 :            : 
     536                 :          0 :         return mnNotifierClientId;
     537                 :            :     }
     538                 :            : 
     539                 :          0 :     void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
     540                 :            :     {
     541                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     542                 :            : 
     543                 :          0 :         uno::Any aOldDesc;
     544                 :          0 :         uno::Any aOldName;
     545                 :            : 
     546                 :            :         try
     547                 :            :         {
     548 [ #  # ][ #  # ]:          0 :             aOldDesc <<= getAccessibleDescription();
     549 [ #  # ][ #  # ]:          0 :             aOldName <<= getAccessibleName();
                 [ #  # ]
     550                 :            :         }
     551         [ #  # ]:          0 :         catch( const uno::Exception& ) {} // optional behaviour
     552                 :            : 
     553                 :          0 :         sal_Int32 nOldIndex = mnParagraphIndex;
     554                 :            : 
     555                 :          0 :         mnParagraphIndex = nIndex;
     556                 :            : 
     557                 :            :         try
     558                 :            :         {
     559         [ #  # ]:          0 :             if( nOldIndex != nIndex )
     560                 :            :             {
     561                 :            :                 // index and therefore description changed
     562 [ #  # ][ #  # ]:          0 :                 FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc );
                 [ #  # ]
     563 [ #  # ][ #  # ]:          0 :                 FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName );
         [ #  # ][ #  # ]
     564                 :            :             }
     565                 :            :         }
     566         [ #  # ]:          0 :         catch( const uno::Exception& ) {} // optional behaviour
     567                 :          0 :     }
     568                 :            : 
     569                 :          0 :     sal_Int32 AccessibleImageBullet::GetParagraphIndex() const SAL_THROW((uno::RuntimeException))
     570                 :            :     {
     571                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     572                 :            : 
     573                 :          0 :         return mnParagraphIndex;
     574                 :            :     }
     575                 :            : 
     576                 :          0 :     SvxEditSource& AccessibleImageBullet::GetEditSource() const SAL_THROW((uno::RuntimeException))
     577                 :            :     {
     578                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     579                 :            : 
     580         [ #  # ]:          0 :         if( mpEditSource )
     581                 :          0 :             return *mpEditSource;
     582                 :            :         else
     583                 :            :             throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")),
     584                 :            :                                         uno::Reference< uno::XInterface >
     585                 :            :                                         ( static_cast< ::cppu::OWeakObject* >
     586 [ #  # ][ #  # ]:          0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
                 [ #  # ]
     587                 :            :     }
     588                 :            : 
     589                 :          0 :     SvxTextForwarder& AccessibleImageBullet::GetTextForwarder() const SAL_THROW((uno::RuntimeException))
     590                 :            :     {
     591                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     592                 :            : 
     593                 :          0 :         SvxEditSource& rEditSource = GetEditSource();
     594                 :          0 :         SvxTextForwarder* pTextForwarder = rEditSource.GetTextForwarder();
     595                 :            : 
     596         [ #  # ]:          0 :         if( !pTextForwarder )
     597                 :            :             throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")),
     598                 :            :                                         uno::Reference< uno::XInterface >
     599                 :            :                                         ( static_cast< ::cppu::OWeakObject* >
     600 [ #  # ][ #  # ]:          0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
                 [ #  # ]
     601                 :            : 
     602         [ #  # ]:          0 :         if( pTextForwarder->IsValid() )
     603                 :          0 :             return *pTextForwarder;
     604                 :            :         else
     605                 :            :             throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")),
     606                 :            :                                         uno::Reference< uno::XInterface >
     607                 :            :                                         ( static_cast< ::cppu::OWeakObject* >
     608 [ #  # ][ #  # ]:          0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
                 [ #  # ]
     609                 :            :     }
     610                 :            : 
     611                 :          0 :     SvxViewForwarder& AccessibleImageBullet::GetViewForwarder() const SAL_THROW((uno::RuntimeException))
     612                 :            :     {
     613                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     614                 :            : 
     615                 :          0 :         SvxEditSource& rEditSource = GetEditSource();
     616                 :          0 :         SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder();
     617                 :            : 
     618         [ #  # ]:          0 :         if( !pViewForwarder )
     619                 :            :         {
     620                 :            :             throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")),
     621                 :            :                                         uno::Reference< uno::XInterface >
     622                 :            :                                         ( static_cast< ::cppu::OWeakObject* >
     623 [ #  # ][ #  # ]:          0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
                 [ #  # ]
     624                 :            :         }
     625                 :            : 
     626         [ #  # ]:          0 :         if( pViewForwarder->IsValid() )
     627                 :          0 :             return *pViewForwarder;
     628                 :            :         else
     629                 :            :             throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")),
     630                 :            :                                         uno::Reference< uno::XInterface >
     631                 :            :                                         ( static_cast< ::cppu::OWeakObject* >
     632 [ #  # ][ #  # ]:          0 :                                           ( const_cast< AccessibleImageBullet* > (this) )  ) ); // disambiguate hierarchy
                 [ #  # ]
     633                 :            :     }
     634                 :            : 
     635                 :          0 :     const Point& AccessibleImageBullet::GetEEOffset() const
     636                 :            :     {
     637                 :            :         DBG_CHKTHIS( AccessibleImageBullet, NULL );
     638                 :            : 
     639                 :          0 :         return maEEOffset;
     640                 :            :     }
     641                 :            : 
     642                 :            : } // end of namespace accessibility
     643                 :            : 
     644                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10