LCOV - code coverage report
Current view: top level - svx/source/accessibility - AccessibleFrameSelector.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 278 0.4 %
Date: 2015-06-13 12:38:46 Functions: 2 38 5.3 %
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 "AccessibleFrameSelector.hxx"
      21             : #include <com/sun/star/awt/KeyEvent.hpp>
      22             : #include <com/sun/star/awt/KeyModifier.hpp>
      23             : #include <com/sun/star/awt/Key.hpp>
      24             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
      26             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      27             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      28             : #include <com/sun/star/awt/FocusChangeReason.hpp>
      29             : #include <cppuhelper/supportsservice.hxx>
      30             : #include <unotools/accessiblestatesethelper.hxx>
      31             : #include <unotools/accessiblerelationsethelper.hxx>
      32             : #include <osl/mutex.hxx>
      33             : #include <vcl/svapp.hxx>
      34             : #include <vcl/settings.hxx>
      35             : #include <svx/frmsel.hxx>
      36             : #include <svx/dialmgr.hxx>
      37             : #include "editeng/unolingu.hxx"
      38             : 
      39             : #include <svx/dialogs.hrc>
      40             : #include "frmsel.hrc"
      41             : 
      42             : namespace svx {
      43             : namespace a11y {
      44             : 
      45             : using ::com::sun::star::uno::Any;
      46             : using ::com::sun::star::uno::UNO_QUERY;
      47             : using ::com::sun::star::uno::Reference;
      48             : using ::com::sun::star::uno::Sequence;
      49             : using ::com::sun::star::uno::RuntimeException;
      50             : using ::com::sun::star::uno::XInterface;
      51             : using ::com::sun::star::lang::Locale;
      52             : using ::com::sun::star::lang::EventObject;
      53             : using ::com::sun::star::beans::XPropertyChangeListener;
      54             : using ::com::sun::star::awt::XFocusListener;
      55             : 
      56             : using namespace ::com::sun::star::accessibility;
      57             : 
      58             : namespace AwtKey                    = ::com::sun::star::awt::Key;
      59             : namespace AwtKeyModifier            = ::com::sun::star::awt::KeyModifier;
      60             : namespace AwtFocusChangeReason      = ::com::sun::star::awt::FocusChangeReason;
      61             : 
      62             : typedef ::com::sun::star::awt::Point        AwtPoint;
      63             : typedef ::com::sun::star::awt::Size         AwtSize;
      64             : typedef ::com::sun::star::awt::Rectangle    AwtRectangle;
      65             : typedef ::com::sun::star::awt::KeyEvent     AwtKeyEvent;
      66             : typedef ::com::sun::star::awt::FocusEvent   AwtFocusEvent;
      67             : 
      68             : 
      69             : 
      70           0 : AccFrameSelector::AccFrameSelector( FrameSelector& rFrameSel, FrameBorderType eBorder ) :
      71           0 :     Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
      72             :     mpFrameSel( &rFrameSel ),
      73             :     meBorder( eBorder ),
      74             :     maFocusListeners( maFocusMutex ),
      75             :     maPropertyListeners( maPropertyMutex ),
      76           0 :     maNames( SVX_RES( ARR_TEXTS ) ),
      77           0 :     maDescriptions( SVX_RES(ARR_DESCRIPTIONS ) ),
      78           0 :     mnClientId( 0 )
      79             : {
      80           0 :     FreeResource();
      81             : 
      82           0 :     if ( mpFrameSel )
      83             :     {
      84           0 :         mpFrameSel->AddEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
      85             :     }
      86           0 : }
      87             : 
      88             : 
      89             : 
      90           0 : AccFrameSelector::~AccFrameSelector()
      91             : {
      92           0 :     RemoveFrameSelEventListener();
      93           0 : }
      94             : 
      95             : 
      96             : 
      97           0 : void AccFrameSelector::RemoveFrameSelEventListener()
      98             : {
      99           0 :     if ( mpFrameSel )
     100             :     {
     101           0 :         mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
     102             :     }
     103           0 : }
     104             : 
     105             : 
     106             : 
     107           0 : Reference< XAccessibleContext > AccFrameSelector::getAccessibleContext(  )
     108             :     throw (RuntimeException, std::exception)
     109             : {
     110           0 :     return this;
     111             : }
     112             : 
     113             : 
     114             : 
     115           0 : sal_Int32 AccFrameSelector::getAccessibleChildCount(  ) throw (RuntimeException, std::exception)
     116             : {
     117           0 :     SolarMutexGuard aGuard;
     118           0 :     IsValid();
     119           0 :     return (meBorder == FRAMEBORDER_NONE) ? mpFrameSel->GetEnabledBorderCount() : 0;
     120             : }
     121             : 
     122           0 : Reference< XAccessible > AccFrameSelector::getAccessibleChild( sal_Int32 i )
     123             :     throw (RuntimeException, std::exception)
     124             : {
     125           0 :     SolarMutexGuard aGuard;
     126           0 :     IsValid();
     127           0 :     Reference< XAccessible > xRet;
     128           0 :     if( meBorder == FRAMEBORDER_NONE )
     129           0 :         xRet = mpFrameSel->GetChildAccessible( i );
     130           0 :     if( !xRet.is() )
     131           0 :         throw RuntimeException();
     132           0 :     return xRet;
     133             : }
     134             : 
     135           0 : Reference< XAccessible > AccFrameSelector::getAccessibleParent(  )
     136             :     throw (RuntimeException, std::exception)
     137             : {
     138           0 :     SolarMutexGuard aGuard;
     139           0 :     IsValid();
     140           0 :     Reference< XAccessible > xRet;
     141           0 :     if(meBorder == FRAMEBORDER_NONE)
     142           0 :         xRet = mpFrameSel->GetParent()->GetAccessible( true );
     143             :     else
     144           0 :         xRet = mpFrameSel->CreateAccessible();
     145           0 :     return xRet;
     146             : }
     147             : 
     148           0 : sal_Int32 AccFrameSelector::getAccessibleIndexInParent(  )
     149             :     throw (RuntimeException, std::exception)
     150             : {
     151           0 :     SolarMutexGuard aGuard;
     152           0 :     IsValid();
     153             : 
     154           0 :     sal_Int32 nIdx = 0;
     155           0 :     if( meBorder == FRAMEBORDER_NONE )
     156             :     {
     157           0 :         vcl::Window* pTabPage = mpFrameSel->GetParent();
     158           0 :         sal_Int32 nChildren = pTabPage->GetChildCount();
     159           0 :         for( nIdx = 0; nIdx < nChildren; ++nIdx )
     160           0 :             if( pTabPage->GetChild( static_cast< sal_uInt16 >( nIdx ) ) == mpFrameSel )
     161           0 :                 break;
     162             :     }
     163             :     else
     164           0 :         nIdx = mpFrameSel->GetEnabledBorderIndex( meBorder );
     165             : 
     166           0 :     if( nIdx < 0 )
     167           0 :         throw RuntimeException();
     168           0 :     return nIdx;
     169             : }
     170             : 
     171           0 : sal_Int16 AccFrameSelector::getAccessibleRole(  ) throw (RuntimeException, std::exception)
     172             : {
     173           0 :     return meBorder == FRAMEBORDER_NONE ? AccessibleRole::OPTION_PANE : AccessibleRole::CHECK_BOX;
     174             : }
     175             : 
     176           0 : OUString AccFrameSelector::getAccessibleDescription(  )
     177             :     throw (RuntimeException, std::exception)
     178             : {
     179           0 :     SolarMutexGuard aGuard;
     180           0 :     IsValid();
     181           0 :     return maDescriptions.GetString(meBorder);
     182             : }
     183             : 
     184           0 : OUString AccFrameSelector::getAccessibleName(  )
     185             :     throw (RuntimeException, std::exception)
     186             : {
     187           0 :     SolarMutexGuard aGuard;
     188           0 :     IsValid();
     189           0 :     return maNames.GetString(meBorder);
     190             : }
     191             : 
     192           0 : Reference< XAccessibleRelationSet > AccFrameSelector::getAccessibleRelationSet(  )
     193             :     throw (RuntimeException, std::exception)
     194             : {
     195           0 :     SolarMutexGuard aGuard;
     196           0 :     IsValid();
     197             :     utl::AccessibleRelationSetHelper* pHelper;
     198           0 :     Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
     199           0 :     if(meBorder == FRAMEBORDER_NONE)
     200             :     {
     201             :         //add the label relation
     202           0 :         vcl::Window *pLabeledBy = mpFrameSel->GetAccessibleRelationLabeledBy();
     203           0 :         if ( pLabeledBy && pLabeledBy != mpFrameSel )
     204             :         {
     205           0 :             AccessibleRelation aLabelRelation;
     206           0 :             aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
     207           0 :             aLabelRelation.TargetSet.realloc(1);
     208           0 :             aLabelRelation.TargetSet.getArray()[0]  = pLabeledBy->GetAccessible();
     209           0 :             pHelper->AddRelation(aLabelRelation);
     210             :         }
     211           0 :         vcl::Window* pMemberOf = mpFrameSel->GetAccessibleRelationMemberOf();
     212           0 :         if ( pMemberOf && pMemberOf != mpFrameSel )
     213             :         {
     214           0 :             AccessibleRelation aMemberOfRelation;
     215           0 :             aMemberOfRelation.RelationType = AccessibleRelationType::MEMBER_OF;
     216           0 :             aMemberOfRelation.TargetSet.realloc(1);
     217           0 :             aMemberOfRelation.TargetSet.getArray()[0]  = pMemberOf->GetAccessible();
     218           0 :             pHelper->AddRelation(aMemberOfRelation);
     219             :         }
     220             :     }
     221           0 :     return xRet;
     222             : }
     223             : 
     224           0 : Reference< XAccessibleStateSet > AccFrameSelector::getAccessibleStateSet(  )
     225             :     throw (RuntimeException, std::exception)
     226             : {
     227           0 :     SolarMutexGuard aGuard;
     228           0 :     utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
     229           0 :     Reference< XAccessibleStateSet > xRet = pStateSetHelper;
     230             : 
     231           0 :     if(!mpFrameSel)
     232           0 :         pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
     233             :     else
     234             :     {
     235             :         const sal_Int16 aStandardStates[] =
     236             :         {
     237             :             AccessibleStateType::EDITABLE,
     238             :             AccessibleStateType::FOCUSABLE,
     239             :             AccessibleStateType::MULTI_SELECTABLE,
     240             :             AccessibleStateType::SELECTABLE,
     241             :             AccessibleStateType::SHOWING,
     242             :             AccessibleStateType::VISIBLE,
     243             :             AccessibleStateType::OPAQUE,
     244           0 :             0};
     245           0 :         sal_Int16 nState = 0;
     246           0 :         while(aStandardStates[nState])
     247             :         {
     248           0 :             pStateSetHelper->AddState(aStandardStates[nState++]);
     249             :         }
     250           0 :         if(mpFrameSel->IsEnabled())
     251             :         {
     252           0 :             pStateSetHelper->AddState(AccessibleStateType::ENABLED);
     253           0 :             pStateSetHelper->AddState(AccessibleStateType::SENSITIVE);
     254             :         }
     255             : 
     256           0 :         bool bIsParent = meBorder == FRAMEBORDER_NONE;
     257           0 :         if(mpFrameSel->HasFocus() &&
     258           0 :             (bIsParent || mpFrameSel->IsBorderSelected(meBorder)))
     259             :         {
     260           0 :             pStateSetHelper->AddState(AccessibleStateType::ACTIVE);
     261           0 :             pStateSetHelper->AddState(AccessibleStateType::FOCUSED);
     262           0 :             pStateSetHelper->AddState(AccessibleStateType::SELECTED);
     263             :         }
     264             :     }
     265           0 :     return xRet;
     266             : }
     267             : 
     268           0 : Locale AccFrameSelector::getLocale(  )
     269             :     throw (IllegalAccessibleComponentStateException, RuntimeException, std::exception)
     270             : {
     271           0 :     return Application::GetSettings().GetUILanguageTag().getLocale();
     272             : }
     273             : 
     274           0 : sal_Bool AccFrameSelector::containsPoint( const AwtPoint& aPt )
     275             :     throw (RuntimeException, std::exception)
     276             : {
     277           0 :     SolarMutexGuard aGuard;
     278           0 :     IsValid();
     279             :     //aPt is relative to the frame selector
     280           0 :     return mpFrameSel->ContainsClickPoint( Point( aPt.X, aPt.Y ) );
     281             : }
     282             : 
     283           0 : Reference< XAccessible > AccFrameSelector::getAccessibleAtPoint(
     284             :     const AwtPoint& aPt )
     285             :         throw (RuntimeException, std::exception)
     286             : {
     287           0 :     SolarMutexGuard aGuard;
     288           0 :     IsValid();
     289             :     //aPt is relative to the frame selector
     290           0 :     return mpFrameSel->GetChildAccessible( Point( aPt.X, aPt.Y ) );
     291             : }
     292             : 
     293           0 : AwtRectangle AccFrameSelector::getBounds(  ) throw (RuntimeException, std::exception)
     294             : {
     295           0 :     SolarMutexGuard aGuard;
     296           0 :     IsValid();
     297           0 :     Size aSz;
     298           0 :     Point aPos;
     299           0 :     switch(meBorder)
     300             :     {
     301             :         case FRAMEBORDER_NONE:
     302           0 :             aSz = mpFrameSel->GetSizePixel();
     303           0 :             aPos = mpFrameSel->GetPosPixel();
     304           0 :         break;
     305             :         default:
     306           0 :             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
     307           0 :             aPos = aSpot.TopLeft();
     308           0 :             aSz = aSpot.GetSize();
     309             :     }
     310           0 :     AwtRectangle aRet;
     311           0 :     aRet.X = aPos.X();
     312           0 :     aRet.Y = aPos.Y();
     313           0 :     aRet.Width = aSz.Width();
     314           0 :     aRet.Height = aSz.Height();
     315           0 :     return aRet;
     316             : }
     317             : 
     318             : 
     319             : 
     320           0 : AwtPoint AccFrameSelector::getLocation(  ) throw (RuntimeException, std::exception)
     321             : {
     322           0 :     SolarMutexGuard aGuard;
     323           0 :     IsValid();
     324           0 :     Point aPos;
     325           0 :     switch(meBorder)
     326             :     {
     327             :         case FRAMEBORDER_NONE:
     328           0 :             aPos = mpFrameSel->GetPosPixel();
     329           0 :         break;
     330             :         default:
     331           0 :             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
     332           0 :             aPos = aSpot.TopLeft();
     333             :     }
     334           0 :     AwtPoint aRet(aPos.X(), aPos.Y());
     335           0 :     return aRet;
     336             : }
     337             : 
     338             : 
     339             : 
     340           0 : AwtPoint AccFrameSelector::getLocationOnScreen(  ) throw (RuntimeException, std::exception)
     341             : {
     342           0 :     SolarMutexGuard aGuard;
     343           0 :     IsValid();
     344           0 :     Point aPos;
     345           0 :     switch(meBorder)
     346             :     {
     347             :         case FRAMEBORDER_NONE:
     348           0 :             aPos = mpFrameSel->GetPosPixel();
     349           0 :         break;
     350             :         default:
     351           0 :             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
     352           0 :             aPos = aSpot.TopLeft();
     353             :     }
     354           0 :     aPos = mpFrameSel->OutputToAbsoluteScreenPixel( aPos );
     355           0 :     AwtPoint aRet(aPos.X(), aPos.Y());
     356           0 :     return aRet;
     357             : }
     358             : 
     359             : 
     360             : 
     361           0 : AwtSize AccFrameSelector::getSize(  ) throw (RuntimeException, std::exception)
     362             : {
     363           0 :     SolarMutexGuard aGuard;
     364           0 :     IsValid();
     365           0 :     Size aSz;
     366           0 :     switch(meBorder)
     367             :     {
     368             :         case FRAMEBORDER_NONE:
     369           0 :             aSz = mpFrameSel->GetSizePixel();
     370           0 :         break;
     371             :         default:
     372           0 :             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
     373           0 :             aSz = aSpot.GetSize();
     374             :     }
     375           0 :     AwtSize aRet(aSz.Width(), aSz.Height());
     376           0 :     return aRet;
     377             : }
     378             : 
     379           0 : void AccFrameSelector::grabFocus(  ) throw (RuntimeException, std::exception)
     380             : {
     381           0 :     SolarMutexGuard aGuard;
     382           0 :     IsValid();
     383           0 :     mpFrameSel->GrabFocus();
     384           0 : }
     385             : 
     386           0 : sal_Int32 AccFrameSelector::getForeground(  )
     387             :         throw (RuntimeException, std::exception)
     388             : {
     389           0 :     SolarMutexGuard aGuard;
     390           0 :     IsValid();
     391           0 :     return mpFrameSel->GetControlForeground().GetColor();
     392             : }
     393             : 
     394           0 : sal_Int32 AccFrameSelector::getBackground(  )
     395             :         throw (RuntimeException, std::exception)
     396             : {
     397           0 :     SolarMutexGuard aGuard;
     398           0 :     IsValid();
     399           0 :     return mpFrameSel->GetControlBackground().GetColor();
     400             : }
     401             : 
     402           0 : void AccFrameSelector::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException, std::exception)
     403             : {
     404           0 :     SolarMutexGuard aGuard;
     405             : 
     406           0 :     if ( xListener.is() )
     407             :     {
     408           0 :         if ( !mnClientId )
     409             :         {
     410           0 :             mnClientId = ::comphelper::AccessibleEventNotifier::registerClient();
     411             :         }
     412           0 :         ::comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
     413           0 :     }
     414           0 : }
     415             : 
     416           0 : void AccFrameSelector::removeAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException, std::exception)
     417             : {
     418           0 :     SolarMutexGuard aGuard;
     419             : 
     420           0 :     if ( xListener.is() && mnClientId != 0 &&
     421           0 :          ::comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ) == 0 )
     422             :     {
     423             :         // no listeners anymore
     424             :         // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     425             :         // and at least to us not firing any events anymore, in case somebody calls
     426             :         // NotifyAccessibleEvent, again
     427           0 :         ::comphelper::AccessibleEventNotifier::TClientId nId( mnClientId );
     428           0 :         mnClientId = 0;
     429           0 :         ::comphelper::AccessibleEventNotifier::revokeClient( nId );
     430           0 :     }
     431           0 : }
     432             : 
     433           0 : OUString AccFrameSelector::getImplementationName(  ) throw (RuntimeException, std::exception)
     434             : {
     435           0 :     return OUString("AccFrameSelector");
     436             : }
     437             : 
     438           0 : sal_Bool AccFrameSelector::supportsService( const OUString& rServiceName )
     439             :     throw (RuntimeException, std::exception)
     440             : {
     441           0 :     return cppu::supportsService(this, rServiceName);
     442             : }
     443             : 
     444           0 : Sequence< OUString > AccFrameSelector::getSupportedServiceNames(  )
     445             :     throw (RuntimeException, std::exception)
     446             : {
     447           0 :     Sequence< OUString > aRet(3);
     448           0 :     OUString* pArray = aRet.getArray();
     449           0 :     pArray[0] = "Accessible";
     450           0 :     pArray[1] = "AccessibleContext";
     451           0 :     pArray[2] = "AccessibleComponent";
     452           0 :     return aRet;
     453             : }
     454             : 
     455           0 : void AccFrameSelector::IsValid() throw (RuntimeException)
     456             : {
     457           0 :     if(!mpFrameSel)
     458           0 :         throw RuntimeException();
     459           0 : }
     460             : 
     461           0 : void    AccFrameSelector::NotifyFocusListeners(bool bGetFocus)
     462             : {
     463           0 :     SolarMutexGuard aGuard;
     464           0 :     AwtFocusEvent aEvent;
     465           0 :     aEvent.FocusFlags = 0;
     466           0 :     if(bGetFocus)
     467             :     {
     468           0 :         GetFocusFlags nFocusFlags = mpFrameSel->GetGetFocusFlags();
     469           0 :         if(nFocusFlags & GetFocusFlags::Tab)
     470           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::TAB;
     471           0 :         if(nFocusFlags & GetFocusFlags::CURSOR)
     472           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::CURSOR;
     473           0 :         if(nFocusFlags & GetFocusFlags::Mnemonic)
     474           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::MNEMONIC;
     475           0 :         if(nFocusFlags & GetFocusFlags::Forward)
     476           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::FORWARD;
     477           0 :         if(nFocusFlags & GetFocusFlags::Backward)
     478           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::BACKWARD;
     479           0 :         if(nFocusFlags & GetFocusFlags::Around)
     480           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::AROUND;
     481           0 :         if(nFocusFlags & GetFocusFlags::UniqueMnemonic)
     482           0 :             aEvent.FocusFlags |= AwtFocusChangeReason::UNIQUEMNEMONIC;
     483             :     }
     484           0 :     aEvent.Temporary = sal_False;
     485             : 
     486           0 :     Reference < XAccessibleContext > xThis( this );
     487           0 :     aEvent.Source = xThis;
     488             : 
     489           0 :     ::cppu::OInterfaceIteratorHelper aIter( maFocusListeners );
     490           0 :     while( aIter.hasMoreElements() )
     491             :     {
     492           0 :         Reference < XFocusListener > xListener( aIter.next(), UNO_QUERY );
     493           0 :         if(bGetFocus)
     494           0 :             xListener->focusGained( aEvent );
     495             :         else
     496           0 :             xListener->focusLost( aEvent );
     497           0 :     }
     498           0 : }
     499             : 
     500             : 
     501             : 
     502           0 : IMPL_LINK( AccFrameSelector, WindowEventListener, VclSimpleEvent*, pEvent )
     503             : {
     504           0 :     VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
     505             :     DBG_ASSERT( pWinEvent, "AccFrameSelector::WindowEventListener - unknown window event" );
     506           0 :     if ( pWinEvent )
     507             :     {
     508           0 :         vcl::Window* pWindow = pWinEvent->GetWindow();
     509             :         DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
     510           0 :         if ( !pWindow->IsAccessibilityEventsSuppressed() || ( pWinEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
     511             :         {
     512           0 :             ProcessWindowEvent( *pWinEvent );
     513             :         }
     514             :     }
     515             : 
     516           0 :     return 0;
     517             : }
     518             : 
     519             : 
     520             : 
     521           0 : void AccFrameSelector::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
     522             : {
     523           0 :     switch ( rVclWindowEvent.GetId() )
     524             :     {
     525             :         case VCLEVENT_WINDOW_GETFOCUS:
     526             :         {
     527           0 :             if ( meBorder == FRAMEBORDER_NONE )
     528             :             {
     529           0 :                 Any aOldValue, aNewValue;
     530           0 :                 aNewValue <<= AccessibleStateType::FOCUSED;
     531           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     532             :             }
     533             :         }
     534           0 :         break;
     535             :         case VCLEVENT_WINDOW_LOSEFOCUS:
     536             :         {
     537           0 :             if ( meBorder == FRAMEBORDER_NONE )
     538             :             {
     539           0 :                 Any aOldValue, aNewValue;
     540           0 :                 aOldValue <<= AccessibleStateType::FOCUSED;
     541           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     542             :             }
     543             :         }
     544           0 :         break;
     545             :         default:
     546             :         {
     547             :         }
     548           0 :         break;
     549             :     }
     550           0 : }
     551             : 
     552             : 
     553             : 
     554           0 : void AccFrameSelector::NotifyAccessibleEvent( const sal_Int16 _nEventId,
     555             :     const Any& _rOldValue, const Any& _rNewValue )
     556             : {
     557           0 :     if ( mnClientId )
     558             :     {
     559           0 :         Reference< XInterface > xSource( *this );
     560           0 :         AccessibleEventObject aEvent( xSource, _nEventId, _rNewValue, _rOldValue );
     561           0 :         ::comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
     562             :     }
     563           0 : }
     564             : 
     565             : 
     566             : 
     567           0 : void AccFrameSelector::Invalidate()
     568             : {
     569           0 :     RemoveFrameSelEventListener();
     570           0 :     mpFrameSel = 0;
     571           0 :     EventObject aEvent;
     572           0 :     Reference < XAccessibleContext > xThis( this );
     573           0 :     aEvent.Source = xThis;
     574           0 :     maFocusListeners.disposeAndClear( aEvent );
     575           0 :     maPropertyListeners.disposeAndClear( aEvent );
     576           0 : }
     577             : 
     578             : 
     579             : 
     580             : }
     581         390 : }
     582             : 
     583             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11