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

Generated by: LCOV version 1.10