LCOV - code coverage report
Current view: top level - editeng/source/accessibility - AccessibleImageBullet.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 206 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 42 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <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             :         {
     211           0 :             const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
     212           0 :             if ( !nListenerCount )
     213             :             {
     214             :                 // no listeners anymore
     215             :                 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     216             :                 // and at least to us not firing any events anymore, in case somebody calls
     217             :                 // NotifyAccessibleEvent, again
     218           0 :                 ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() );
     219           0 :                 mnNotifierClientId = -1;
     220           0 :                 ::comphelper::AccessibleEventNotifier::revokeClient( nId );
     221             :             }
     222             :         }
     223           0 :     }
     224             : 
     225           0 :     sal_Bool SAL_CALL AccessibleImageBullet::containsPoint( const awt::Point& rPoint ) throw (uno::RuntimeException, std::exception)
     226             :     {
     227             : 
     228           0 :         SolarMutexGuard aGuard;
     229             : 
     230             :         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
     231             :                    "AccessibleEditableTextPara::contains: index value overflow");
     232             : 
     233           0 :         awt::Rectangle aTmpRect = getBounds();
     234           0 :         Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) );
     235           0 :         Point aPoint( rPoint.X, rPoint.Y );
     236             : 
     237           0 :         return aRect.IsInside( aPoint );
     238             :     }
     239             : 
     240           0 :     uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) throw (uno::RuntimeException, std::exception)
     241             :     {
     242             : 
     243             :         // as we have no children, empty reference
     244           0 :         return uno::Reference< XAccessible >();
     245             :     }
     246             : 
     247           0 :     awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds(  ) throw (uno::RuntimeException, std::exception)
     248             :     {
     249             : 
     250           0 :         SolarMutexGuard aGuard;
     251             : 
     252             :         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
     253             :                    "AccessibleEditableTextPara::getBounds: index value overflow");
     254             : 
     255           0 :         SvxTextForwarder& rCacheTF = GetTextForwarder();
     256           0 :         EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( GetParagraphIndex() );
     257           0 :         Rectangle aParentRect = rCacheTF.GetParaBounds( GetParagraphIndex() );
     258             : 
     259           0 :         if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
     260           0 :             aBulletInfo.bVisible &&
     261           0 :             aBulletInfo.nType == SVX_NUM_BITMAP )
     262             :         {
     263           0 :             Rectangle aRect = aBulletInfo.aBounds;
     264             : 
     265             :             // subtract paragraph position (bullet pos is absolute in EditEngine/Outliner)
     266           0 :             aRect.Move( -aParentRect.Left(), -aParentRect.Top() );
     267             : 
     268             :             // convert to screen coordinates
     269             :             Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
     270           0 :                                                                               rCacheTF.GetMapMode(),
     271           0 :                                                                               GetViewForwarder() );
     272             : 
     273             :             // offset from shape/cell
     274           0 :             Point aOffset = GetEEOffset();
     275             : 
     276           0 :             return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
     277           0 :                                    aScreenRect.Top() + aOffset.Y(),
     278           0 :                                    aScreenRect.GetSize().Width(),
     279           0 :                                    aScreenRect.GetSize().Height() );
     280             :         }
     281             : 
     282           0 :         return awt::Rectangle();
     283             :     }
     284             : 
     285           0 :     awt::Point SAL_CALL AccessibleImageBullet::getLocation(  ) throw (uno::RuntimeException, std::exception)
     286             :     {
     287             : 
     288           0 :         SolarMutexGuard aGuard;
     289             : 
     290           0 :         awt::Rectangle aRect = getBounds();
     291             : 
     292           0 :         return awt::Point( aRect.X, aRect.Y );
     293             :     }
     294             : 
     295           0 :     awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen(  ) throw (uno::RuntimeException, std::exception)
     296             :     {
     297             : 
     298           0 :         SolarMutexGuard aGuard;
     299             : 
     300             :         // relate us to parent
     301           0 :         uno::Reference< XAccessible > xParent = getAccessibleParent();
     302           0 :         if( xParent.is() )
     303             :         {
     304           0 :             uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
     305           0 :             if( xParentComponent.is() )
     306             :             {
     307           0 :                 awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
     308           0 :                 awt::Point aPoint = getLocation();
     309           0 :                 aPoint.X += aRefPoint.X;
     310           0 :                 aPoint.Y += aRefPoint.Y;
     311             : 
     312           0 :                 return aPoint;
     313           0 :             }
     314             :         }
     315             : 
     316             :         throw uno::RuntimeException("Cannot access parent",
     317             :                                     uno::Reference< uno::XInterface >
     318           0 :                                     ( static_cast< XAccessible* > (this) ) );   // disambiguate hierarchy
     319             :     }
     320             : 
     321           0 :     awt::Size SAL_CALL AccessibleImageBullet::getSize(  ) throw (uno::RuntimeException, std::exception)
     322             :     {
     323             : 
     324           0 :         SolarMutexGuard aGuard;
     325             : 
     326           0 :         awt::Rectangle aRect = getBounds();
     327             : 
     328           0 :         return awt::Size( aRect.Width, aRect.Height );
     329             :     }
     330             : 
     331           0 :     void SAL_CALL AccessibleImageBullet::grabFocus(  ) throw (uno::RuntimeException, std::exception)
     332             :     {
     333             : 
     334             :         throw uno::RuntimeException("Not focusable",
     335             :                                     uno::Reference< uno::XInterface >
     336           0 :                                     ( static_cast< XAccessible* > (this) ) );   // disambiguate hierarchy
     337             :     }
     338             : 
     339           0 :     sal_Int32 SAL_CALL AccessibleImageBullet::getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     340             :     {
     341             : 
     342             :         // #104444# Added to XAccessibleComponent interface
     343           0 :         svtools::ColorConfig aColorConfig;
     344           0 :         sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     345           0 :         return static_cast<sal_Int32>(nColor);
     346             :     }
     347             : 
     348           0 :     sal_Int32 SAL_CALL AccessibleImageBullet::getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     349             :     {
     350             : 
     351             :         // #104444# Added to XAccessibleComponent interface
     352           0 :         Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() );
     353             : 
     354             :         // the background is transparent
     355           0 :         aColor.SetTransparency( 0xFF);
     356             : 
     357           0 :         return static_cast<sal_Int32>( aColor.GetColor() );
     358             :     }
     359             : 
     360           0 :     OUString SAL_CALL AccessibleImageBullet::getImplementationName() throw (uno::RuntimeException, std::exception)
     361             :     {
     362             : 
     363           0 :         return OUString("AccessibleImageBullet");
     364             :     }
     365             : 
     366           0 :     sal_Bool SAL_CALL AccessibleImageBullet::supportsService (const OUString& sServiceName) throw (uno::RuntimeException, std::exception)
     367             :     {
     368             : 
     369           0 :         return cppu::supportsService(this, sServiceName);
     370             :     }
     371             : 
     372           0 :     uno::Sequence< OUString > SAL_CALL AccessibleImageBullet::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
     373             :     {
     374             : 
     375           0 :         const OUString sServiceName ("com.sun.star.accessibility.AccessibleContext");
     376           0 :         return uno::Sequence< OUString > (&sServiceName, 1);
     377             :     }
     378             : 
     379           0 :     void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex )
     380             :     {
     381             : 
     382           0 :         mnIndexInParent = nIndex;
     383           0 :     }
     384             : 
     385           0 :     void AccessibleImageBullet::SetEEOffset( const Point& rOffset )
     386             :     {
     387             : 
     388           0 :         maEEOffset = rOffset;
     389           0 :     }
     390             : 
     391           0 :     void AccessibleImageBullet::Dispose()
     392             :     {
     393             : 
     394           0 :         int nClientId( getNotifierClientId() );
     395             : 
     396             :         // #108212# drop all references before notifying dispose
     397           0 :         mxParent = NULL;
     398           0 :         mnNotifierClientId = -1;
     399           0 :         mpEditSource = NULL;
     400             : 
     401             :         // notify listeners
     402           0 :         if( nClientId != -1 )
     403             :         {
     404             :             try
     405             :             {
     406           0 :                 uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
     407             : 
     408             :                 // #106234# Delegate to EventNotifier
     409           0 :                 ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
     410             : #ifdef DBG_UTIL
     411             :                 OSL_TRACE( "AccessibleImageBullet disposed ID: %d", nClientId );
     412             : #endif
     413             :             }
     414           0 :             catch( const uno::Exception& ) {}
     415             :         }
     416           0 :     }
     417             : 
     418           0 :     void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource )
     419             :     {
     420             : 
     421           0 :         mpEditSource = pEditSource;
     422             : 
     423           0 :         if( !mpEditSource )
     424             :         {
     425             :             // going defunc
     426           0 :             UnSetState( AccessibleStateType::SHOWING );
     427           0 :             UnSetState( AccessibleStateType::VISIBLE );
     428           0 :             SetState( AccessibleStateType::INVALID );
     429           0 :             SetState( AccessibleStateType::DEFUNC );
     430             : 
     431           0 :             Dispose();
     432             :         }
     433           0 :     }
     434             : 
     435           0 :     void AccessibleImageBullet::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
     436             :     {
     437             : 
     438           0 :         uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() );
     439             : 
     440           0 :         AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue);
     441             : 
     442             :         // #106234# Delegate to EventNotifier
     443           0 :         ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(),
     444           0 :                                                          aEvent );
     445           0 :     }
     446             : 
     447           0 :     void AccessibleImageBullet::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const
     448             :     {
     449             : 
     450           0 :         FireEvent( nEventId, rNewValue );
     451           0 :     }
     452             : 
     453           0 :     void AccessibleImageBullet::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const
     454             :     {
     455             : 
     456           0 :         FireEvent( nEventId, uno::Any(), rOldValue );
     457           0 :     }
     458             : 
     459           0 :     void AccessibleImageBullet::SetState( const sal_Int16 nStateId )
     460             :     {
     461             : 
     462           0 :         ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     463           0 :         if( pStateSet != NULL &&
     464           0 :             !pStateSet->contains(nStateId) )
     465             :         {
     466           0 :             pStateSet->AddState( nStateId );
     467           0 :             GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
     468             :         }
     469           0 :     }
     470             : 
     471           0 :     void AccessibleImageBullet::UnSetState( const sal_Int16 nStateId )
     472             :     {
     473             : 
     474           0 :         ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     475           0 :         if( pStateSet != NULL &&
     476           0 :             pStateSet->contains(nStateId) )
     477             :         {
     478           0 :             pStateSet->RemoveState( nStateId );
     479           0 :             LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
     480             :         }
     481           0 :     }
     482             : 
     483             : 
     484           0 :     void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
     485             :     {
     486             : 
     487           0 :         uno::Any aOldDesc;
     488           0 :         uno::Any aOldName;
     489             : 
     490             :         try
     491             :         {
     492           0 :             aOldDesc <<= getAccessibleDescription();
     493           0 :             aOldName <<= getAccessibleName();
     494             :         }
     495           0 :         catch( const uno::Exception& ) {} // optional behaviour
     496             : 
     497           0 :         sal_Int32 nOldIndex = mnParagraphIndex;
     498             : 
     499           0 :         mnParagraphIndex = nIndex;
     500             : 
     501             :         try
     502             :         {
     503           0 :             if( nOldIndex != nIndex )
     504             :             {
     505             :                 // index and therefore description changed
     506           0 :                 FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc );
     507           0 :                 FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName );
     508             :             }
     509             :         }
     510           0 :         catch( const uno::Exception& ) {} // optional behaviour
     511           0 :     }
     512             : 
     513             : 
     514           0 :     SvxEditSource& AccessibleImageBullet::GetEditSource() const
     515             :     {
     516             : 
     517           0 :         if( mpEditSource )
     518           0 :             return *mpEditSource;
     519             :         else
     520             :             throw uno::RuntimeException("No edit source, object is defunct",
     521             :                                         uno::Reference< uno::XInterface >
     522             :                                         ( static_cast< ::cppu::OWeakObject* >
     523           0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
     524             :     }
     525             : 
     526           0 :     SvxTextForwarder& AccessibleImageBullet::GetTextForwarder() const
     527             :     {
     528             : 
     529           0 :         SvxEditSource& rEditSource = GetEditSource();
     530           0 :         SvxTextForwarder* pTextForwarder = rEditSource.GetTextForwarder();
     531             : 
     532           0 :         if( !pTextForwarder )
     533             :             throw uno::RuntimeException("Unable to fetch text forwarder, object is defunct",
     534             :                                         uno::Reference< uno::XInterface >
     535             :                                         ( static_cast< ::cppu::OWeakObject* >
     536           0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
     537             : 
     538           0 :         if( pTextForwarder->IsValid() )
     539           0 :             return *pTextForwarder;
     540             :         else
     541             :             throw uno::RuntimeException("Text forwarder is invalid, object is defunct",
     542             :                                         uno::Reference< uno::XInterface >
     543             :                                         ( static_cast< ::cppu::OWeakObject* >
     544           0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
     545             :     }
     546             : 
     547           0 :     SvxViewForwarder& AccessibleImageBullet::GetViewForwarder() const
     548             :     {
     549             : 
     550           0 :         SvxEditSource& rEditSource = GetEditSource();
     551           0 :         SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder();
     552             : 
     553           0 :         if( !pViewForwarder )
     554             :         {
     555             :             throw uno::RuntimeException("Unable to fetch view forwarder, object is defunct",
     556             :                                         uno::Reference< uno::XInterface >
     557             :                                         ( static_cast< ::cppu::OWeakObject* >
     558           0 :                                           ( const_cast< AccessibleImageBullet* > (this) ) ) );  // disambiguate hierarchy
     559             :         }
     560             : 
     561           0 :         if( pViewForwarder->IsValid() )
     562           0 :             return *pViewForwarder;
     563             :         else
     564             :             throw uno::RuntimeException("View forwarder is invalid, object is defunct",
     565             :                                         uno::Reference< uno::XInterface >
     566             :                                         ( static_cast< ::cppu::OWeakObject* >
     567           0 :                                           ( const_cast< AccessibleImageBullet* > (this) )  ) ); // disambiguate hierarchy
     568             :     }
     569             : 
     570             : 
     571             : } // end of namespace accessibility
     572             : 
     573             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11