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

Generated by: LCOV version 1.10